<?php $s = [ 25, 12, 23, 1006, 13, 114, 11, 34, 18, 13, 112 ]; sort($s); $func = function($a, $b){ $first_digitA = substr($a, 0, 1); $first_digitB = substr($b, 0, 1); if($first_digitA < $first_digitB){ return -1; } else if( $first_digitA > $first_digitB ){ return 1; } else { return 0; } }; usort($s, $func); print_r($s);
You have javascript disabled. You will not be able to edit any code.