将最后一个元素从stdclass对象数组的底部放到顶部

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.

A combination of array_unshift() and array_pop() will do the trick. This will always take the last element from the array and put it on the front.

array_unshift($_SESSION['questions'], array_pop($_SESSION['questions']));

DEMO