I am having problem trying to sort an array - I want all the IsOpen = 1 to appear at the top?
Example:
Array
(
[0] => Array
(
[Isopen] => 0
)
[2] => Array
(
[Isopen] => 1
)
[3] => Array
(
[Isopen] => 0
)
[4] => Array
(
[Isopen] => 1
)
Code:
function cmp($a, $b) {
if ($a['Isopen'] >= $b['Isopen']) {
return 0;
}
}
usort($data['rowResult'], "cmp");
I don't understand what does $a and $b mean, I had a look at the PHP documentation - information is not clear.