I have a simple PHP array that looks like this...
Array
(
[0] => WP_Term Object
(
[id] => 455
)
[1] => WP_Term Object
(
[id] => 738
)
[2] => WP_Term Object
(
[id] => 88
)
[3] => WP_Term Object
(
[id] => 905
)
)
I am trying to sort this array by putting id 88
at the top but leaving the order the same for everything else. So I end up with...
Array
(
[0] => WP_Term Object
(
[id] => 88
)
[1] => WP_Term Object
(
[id] => 455
)
[2] => WP_Term Object
(
[id] => 738
)
[3] => WP_Term Object
(
[id] => 905
)
)
I had though about looping through the array first and removing the item with id 88
and then aftwrard reinserting it at the top.
Is this the correct approach or is there a more efficient way?