3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sizes = array("L", "XXXL", "M", "S", "FOO"); 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 false; } usort($sizes, "compare"); print_r($sizes);
Output for 4.3.0 - 7.1.0
Array ( [0] => FOO [1] => S [2] => M [3] => L [4] => XXXL )