3v4l.org

run code in 300+ PHP versions simultaneously
<?php $menu = [ (object)[ 'tid' => 24, 'name' => 'Sample', 'weight' => 3, 'depth' => 0 ], (object)[ 'tid' => 66, 'name' => 'Sample Subcategory', 'weight' => 0, 'depth' => 1 ], (object)[ 'tid' => 67, 'name' => 'Another Example', 'weight' => 1, 'depth' => 0 ], (object)[ 'tid' => 68, 'name' => 'Subcategory for Another Example', 'weight' => 1, 'depth' => 1 ], (object)[ 'tid' => 22, 'name' => 'A third example master category', 'weight' => 0, 'depth' => 0 ] ]; usort($menu, function($a, $b) { return [$a->depth, $a->weight] <=> [$b->depth, $b->weight]; }); var_export($menu);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => (object) array( 'tid' => 22, 'name' => 'A third example master category', 'weight' => 0, 'depth' => 0, ), 1 => (object) array( 'tid' => 67, 'name' => 'Another Example', 'weight' => 1, 'depth' => 0, ), 2 => (object) array( 'tid' => 24, 'name' => 'Sample', 'weight' => 3, 'depth' => 0, ), 3 => (object) array( 'tid' => 66, 'name' => 'Sample Subcategory', 'weight' => 0, 'depth' => 1, ), 4 => (object) array( 'tid' => 68, 'name' => 'Subcategory for Another Example', 'weight' => 1, 'depth' => 1, ), )

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.36 ms | 407 KiB | 5 Q