3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array('person f','person c','person g','person a','person d','person e'); $last = array('person a','person c','person g'); usort($data,function($a,$b) use($last){ return in_array($a,$last) <=> in_array($b,$last) //sort if in $last ?: $a <=> $b; //sort alphabetically }); var_export($data);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'person d', 1 => 'person e', 2 => 'person f', 3 => 'person a', 4 => 'person c', 5 => 'person g', )

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:
38.91 ms | 405 KiB | 5 Q