Hi gotta array of Std class objects like
Array
(
[0] => stdClass Object(
[id] => 2
[name] => sven
)
[1] => stdClass Object(
[id] => 88
[name] => pat
)
[2] => stdClass Object(
[id] => 63
[name] => dan
)
)
and a order array like
$order = array(88,2,63);
how to sort it by my custom order? i tried to usort like
usort($myArray, function ($a, $b) use ($order) {
$pos_a = array_search($a, $order);
$pos_b = array_search($b, $order);
return $pos_a - $pos_b;
});
with no success because of the std class array_search will not work