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], ]; $result = []; foreach ($array as $key => $row) { $result[array_pop($row)][$key] = $row; } var_export($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:
48.8 ms | 406 KiB | 5 Q