It doesn't appear that any of the builtin array sorting functions let you access both key and value at the same time, which seems to be what you need here, since the sorting algorithms behind the scenes don't look to be stable.
I scratched this up (coded for clarity rather than elegance), it might help. It doesn't do "in place" sorting, but if the dataset isn't too huge, it might do what you need to.
function group_array($ary){
$t = array();
$f = array();
$res = array();
foreach (array_keys($ary) as $k){ //Assuming that you're 100% sure that the input array keys are already ordered
if ($ary[$k] == 'true') {
$t[] = $k;
} else if ($ary[$k] == 'false') {
$f[] = $k;
}
}
foreach ($t as $true_key){
$res[$true_key] = 'true';
}
foreach ($f as $false_key){
$res[$false_key] = 'false';
}
return $res;
}