3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array("A","BC","AA","C","BB", "B"); function lensort($a,$b){ $la = strlen( $a); $lb = strlen( $b); if( $la == $lb) { return strcmp( $a, $b); } return $la - $lb; } usort($array,'lensort'); print_r( $array);
Output for 4.3.0 - 7.1.10
Array ( [0] => A [1] => B [2] => C [3] => AA [4] => BB [5] => BC )