php sort array by value length

40

function sortByLength($a,$b){
    return strlen($b)-strlen($a);
}
usort($array,'sortByLength');

Comments

Submit
0 Comments