无法使排序数组工作[重复]

Possible Duplicate:
php sort($array) not working - returning 1 instead of sorted array

I'm having a difficult time getting array sort() function to work as expected, I've also tried ksort() etc. :::

This Works Fine

foreach( (array) $query as $post ) {
   $VP = ( ( empty($PMD['vehicle_price'][0]) ) ?  $VP = 'On Request' : $VP = $PMD['vehicle_price'][0] ); 
      $vehicle_p[] = $VP;
}

$return = array_count_values($vehicle_p); //Key Value Unique ( count )

foreach($return as $value => $count) {
   <li><span class="key">' . $value . '</span> (' . $count . ')</li>
}

End Result: 480000 (1), 80000 (2), 120400 (1)

I now want to sort this so 80000 (2) is first in list folowed by 120400 (1) then 480000 (1)

As soon as I add any sort() function like below I only get an output 1

I'm not able to get this to work any help would bew appreciated

$return = array_count_values($vehicle_p); //Key Value Unique ( count )
$return = sort($return);
print_r($return);

If i understand correctly you want to sort the array by ascending values? if this is correct Look at asort() which will sort the array by value but keep the index/key intact

http://php.net/manual/en/function.asort.php

Keep in mind that the sort functions return a Boolean so don't assign them to a variable, just call the function on the array.

asort($array);

the sort function returns a boolean value.

So, you are effectively overwriting the contents of $return after it has been sorted by assigning this boolean to $return.

Simply do

sort($return);