<?php $array = [ 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', ]; function multisort($array) { array_multisort(array_map('strlen', $array), SORT_DESC, $array); printf( "Total strlen() calls: %d\n%s\n---\n", count($array), var_export($array, true) ); } function usersort($array) { usort( $array, function($a, $b) { echo "strlen() called twice\n"; return strlen($b) <=> strlen($a); } ); var_export($array); echo "\n---\n"; } multisort($array); usersort($array);
You have javascript disabled. You will not be able to edit any code.