php sort array by value length

Solutions on MaxInterview for php sort array by value length by the best coders in the world

showing results for - "php sort array by value length"
Hannah
20 Sep 2019
1function sortByLength($a,$b){
2    return strlen($b)-strlen($a);
3}
4usort($array,'sortByLength');