Reputation: 41
I have this array in my PHP code:
Array
(
[190] => 2
[193] => 1
[196] => 1
[199] => 1
[206] => 2
[208] => 2
)
I need to sort it in descending order. I am doing this:
$sortDid = arsort($dids);
But this is not working -- $sortDid
is always true
.
Upvotes: 0
Views: 47
Reputation: 1319
arsort
modify array by reference. arsort
returns bool
value. Remove assign to variable:
arsort($dids);
var_dump($dids);
Upvotes: 5