Sorting 2d-array in PHP by value -


this question has answer here:

i have code :

$diagnose[$count][$row['result']];

i need sort array value of [$count]

as understand, want sort array key value ($count).

you should use ksort() (low high) or krsort() (high low). sorts array key, maintaining key data correlations.

example:

$fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); ksort($fruits); 

in case should be:

ksort($diagnose); 

to sort value use asort().

find out more here sorting functions: http://php.net/manual/en/array.sorting.php


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -