3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ["id" => 1, "qt" => 1000, "sa" => 50], ["id" => 2, "qt" => 0, "sa" => 50], ["id" => 3, "qt" => 0, "sa" => 350], ["id" => 4, "qt" => 5000, "sa" => 250], ["id" => 5, "qt" => 10, "sa" => 9000] ]; usort( $array, function($a, $b) { return [$b['qt'] > 0, $b['sa']] <=> [$a['qt'] > 0, $a['sa']]; } ); var_export($array);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'id' => 5, 'qt' => 10, 'sa' => 9000, ), 1 => array ( 'id' => 4, 'qt' => 5000, 'sa' => 250, ), 2 => array ( 'id' => 1, 'qt' => 1000, 'sa' => 50, ), 3 => array ( 'id' => 3, 'qt' => 0, 'sa' => 350, ), 4 => array ( 'id' => 2, 'qt' => 0, 'sa' => 50, ), )

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