3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = [ ['id' => 1, 'countries' => 'EN,CH,SP'], ['id' => 2, 'countries' => 'GE,SP,SV'], ['id' => 3, 'countries' => 'PR,SP,IT'], ['id' => 4, 'countries' => 'EN'], ['id' => 5, 'countries' => 'SP,EN'], ['id' => 6, 'countries' => 'SV,SP,EN'], ['id' => 7, 'countries' => 'GE,SP'], ['id' => 8, 'countries' => 'FR'], ['id' => 9, 'countries' => 'RU,EN'], ['id' => 10, 'countries' => 'EN,SP,IT'], ['id' => 11, 'countries' => 'SP,GR'], ['id' => 12, 'countries' => 'GR,EN'] ]; usort($test, function($a, $b) { return [strpos($a['countries'], 'EN') === false, $a['id']] <=> [strpos($b['countries'], 'EN') === false, $b['id']]; }); var_export($test);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'id' => 1, 'countries' => 'EN,CH,SP', ), 1 => array ( 'id' => 4, 'countries' => 'EN', ), 2 => array ( 'id' => 5, 'countries' => 'SP,EN', ), 3 => array ( 'id' => 6, 'countries' => 'SV,SP,EN', ), 4 => array ( 'id' => 9, 'countries' => 'RU,EN', ), 5 => array ( 'id' => 10, 'countries' => 'EN,SP,IT', ), 6 => array ( 'id' => 12, 'countries' => 'GR,EN', ), 7 => array ( 'id' => 2, 'countries' => 'GE,SP,SV', ), 8 => array ( 'id' => 3, 'countries' => 'PR,SP,IT', ), 9 => array ( 'id' => 7, 'countries' => 'GE,SP', ), 10 => array ( 'id' => 8, 'countries' => 'FR', ), 11 => array ( 'id' => 11, 'countries' => 'SP,GR', ), )

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:
114.09 ms | 407 KiB | 5 Q