I have a code :
$diagnose[$count][$row['result']];
I need to sort array by the value of [$count]
I have a code :
$diagnose[$count][$row['result']];
I need to sort array by the value of [$count]
As I understand, you want to sort the array by the key value ($count
).
You should use ksort()
(low to high) or krsort()
(high to low). Sorts an array by key, maintaining key to data correlations.
Example:
$fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
ksort($fruits);
In your case it should be:
ksort($diagnose);
To sort by value use asort()
.
Find out more here sorting functions: http://php.net/manual/en/array.sorting.php