← All built-ins / asort()
asort()
asort(array &$a): bool
Parameters
| Name | Type | Description |
|---|---|---|
| $a | array | map to sort by value (by reference) |
Return value
true; sorted ascending by value, keys kept.
Example
$m = ["x" => 3, "y" => 1]; asort($m); echo array_key_first($m);
y