3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['cust' => 'XT8900', 'type' => 'standard', 'level' => 1], ['cust' => 'XT8944', 'type' => 'standard', 'level' => 1], ['cust' => 'XT8922', 'type' => 'premier', 'level' => 3], ['cust' => 'XT8816', 'type' => 'permier', 'level' => 3], ['cust' => 'XT7434', 'type' => 'standard', 'level' => 7], ]; var_export( array_reduce( array_keys($array), function($result, $key) use ($array) { $result[array_pop($array[$key])][$key] = $array[$key]; return $result; } ) );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 1 => array ( 0 => array ( 'cust' => 'XT8900', 'type' => 'standard', ), 1 => array ( 'cust' => 'XT8944', 'type' => 'standard', ), ), 3 => array ( 2 => array ( 'cust' => 'XT8922', 'type' => 'premier', ), 3 => array ( 'cust' => 'XT8816', 'type' => 'permier', ), ), 7 => array ( 4 => array ( 'cust' => 'XT7434', 'type' => 'standard', ), ), )

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:
44.3 ms | 402 KiB | 8 Q