3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sizes = array("L", "XXXL", "INVALID", "M", "S"); function compare($a, $b) { $sizeincrement = array("XS", "S", "M", "L", "XL", "XXL", "XXXL"); if(in_array($a, $sizeincrement)) return array_search($a, $sizeincrement) > array_search($b, $sizeincrement); else return true; } usort($sizes, "compare"); print_r($sizes);
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => S [1] => M [2] => INVALID [3] => L [4] => XXXL )
Output for 4.3.0 - 5.6.28
Array ( [0] => M [1] => L [2] => XXXL [3] => INVALID [4] => S )