<?
function array_non_empty_items($input) {
// If it is an element, then just return it
if (!is_array($input)) {
return $input;
}
$non_empty_items = array();
foreach ($input as $key => $value) {
// Ignore empty cells
if($value) {
// Use recursion to evaluate cells
$non_empty_items[$key] = array_non_empty_items($value);
}
}
// Finally return the array without empty items
return $non_empty_items;
}
?>