Lets say I have an array like
$array = array(
'abc' => true,
'def' => true,
'ghi' => true,
'jkl' => false
);
This is an over simplified example, in actuality the values are objects which have a status of 'active' or 'inactive'.
class myObject {
var $tab_name;
var $active;
}
This is used to build an array of tabs for a tab view where order is important.
Now if I toggle one of my values
$array['abc'] = false;
$array['jkl'] = true;
How can I reorder the array (actually an ordered map) so that the true
values remain at the front, retaining their order (any additions should be appended) and the false
values remain at the rear (order NOT important)?
IE. I expect the output to be:
array (
'def' => true,
'ghi' => true,
'jkl' => true,
'abc' => false
);
All I know beforehand is the key of the value being toggled.