3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['type' => 'fruit', 'name' => 'apple', 'cost' => 1], ['type' => 'fruit', 'name' => 'orange', 'cost' => 2], ['type' => 'vegetable', 'name' => 'carrot', 'cost' => 2.5], ['type' => 'vegetable', 'name' => 'avocado', 'cost' => 3.5] ]; $result = []; foreach ($array as ['type' => $type, 'type' => $result[$type]['type'], 'name' => $name, 'cost' => $result[$type][$name]]); var_export(array_values($result));
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'type' => 'fruit', 'apple' => 1, 'orange' => 2, ), 1 => array ( 'type' => 'vegetable', 'carrot' => 2.5, 'avocado' => 3.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:
155.31 ms | 405 KiB | 5 Q