3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( array("id"=>3, "name"=>"peter"), array("id"=>1, "name"=>"steve"), array("id"=>5, "name"=>"damian"), array("id"=>9, "name"=>"ethan") ); $compare = function($key, $order = SORT_DESC) { return function($a, $b) use ($key, $order) { if ($order === SORT_ASC) $order = -1; else $order = 1; if (is_numeric($a[$key])) return $order * ($a[$key] - $b[$key]); if (is_string($a[$key])) return $order * strcmp($a[$key], $b[$key]); return 0; }; }; usort($data, $compare("id", SORT_ASC)); print_r($data);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [id] => 9 [name] => ethan ) [1] => Array ( [id] => 5 [name] => damian ) [2] => Array ( [id] => 3 [name] => peter ) [3] => Array ( [id] => 1 [name] => steve ) )

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