I have this array
[questions] => Array
(
[0] => stdClass Object
(
[quid] => 1
)
[1] => stdClass Object
(
[quid] => 2
)
[2] => stdClass Object
(
[quid] => 64
)
)
And I was trying to move the value 64 at the top and then 1 and 2 will come.My code is
function sortById($x, $y) {
return $x->quid - $y->quid;
}
usort($_SESSION['questions'], 'sortById');
but it doesn't work.