asort() Function in PHP 8.2, PHP 8.3 & PHP 8.4 With Example

The `asort()` function in PHP is used to sort an associative array in ascending order, while preserving the original key-value associations. Syntax:
asort(array &$array, int $flags = SORT_REGULAR): bool
Example:-
<?php
$fruits = [
"b" => "Banana",
"a" => "Apple",
"d" => "Dragonfruit",
"c" => "Cherry"
];
asort($fruits); // Sorts values while keeping keys
print_r($fruits);
?>
Output:
Array
(
[a] => Apple
[b] => Banana
[c] => Cherry
[d] => Dragonfruit
)