This angered me. I couldn’t find a way to turn multidimensional arrays into a single array with only keys that are not empty. Should support infinite dimensions. Haven’t hard tested it but it works for what I needed it for.
// DE MULTIDIMENSIONAL
function single($ar, $new = array())
{
$new = $new;
foreach($ar as $key => $data)
{
if(is_array($data))
{
$new = single($data, $new);
}
else if(!empty($data))
{
$new[$key] = $data;
}
}
return $new;
}