Skip to content Skip to footer navigation
You are reading the docs for an old version of Statamic. Consider upgrading to Statamic 6.

Collapse Modifier

Collapses an array of arrays into a flat array. If duplicate keys exist they will get stomped over.

numbers:
- [one, two, three]
- [four, five, six]
{{ numbers | collapse }}
<?php
$collapsed = Satamic::modify($numbers)->collapse()->fetch();
?>
numbers:
- one
- two
- three
- four
- five
- six