|
ArrayObject::uasortSort the entries with a user-defined comparison function and maintain key association Description
public true ArrayObject::uasort(callable
$callback )This function sorts the entries such that keys maintain their correlation with the entry that they are associated with, using a user-defined comparison function. This is used mainly when sorting associative arrays where the actual element order is significant.
Parameters
Return Values
Always returns Changelog
Examples
Example #1 ArrayObject::uasort example
The above example will output: object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(8) { ["a"]=> int(4) ["b"]=> int(8) ["c"]=> int(-1) ["d"]=> int(-9) ["e"]=> int(2) ["f"]=> int(5) ["g"]=> int(3) ["h"]=> int(-4) } } object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(8) { ["d"]=> int(-9) ["h"]=> int(-4) ["c"]=> int(-1) ["e"]=> int(2) ["g"]=> int(3) ["a"]=> int(4) ["f"]=> int(5) ["b"]=> int(8) } } See Also
|