3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['type' => 'Recurring', 'id' => 1], ['type' => 'Single', 'id' => 2], ['type' => 'Other', 'id' => 3], ['type' => 'Recurring', 'id' => 4], ['type' => 'Single', 'id' => 5], ]; $result = []; foreach ($array as $row) { if (in_array($row['type'], ['Recurring', 'Single'])) { $result[strtolower($row['type'])][] = $row; } } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'recurring' => array ( 0 => array ( 'type' => 'Recurring', 'id' => 1, ), 1 => array ( 'type' => 'Recurring', 'id' => 4, ), ), 'single' => array ( 0 => array ( 'type' => 'Single', 'id' => 2, ), 1 => array ( 'type' => 'Single', 'id' => 5, ), ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
96.59 ms | 406 KiB | 5 Q