$panel) { foreach($panel as $rowCount=>$row) { $emptyCount = 0; foreach($row as $key=>$column) { if(is_array($column) && (!isset($column['name']) || empty($column['name']))) { $emptyCount++; } else if(!is_array($column) && (!isset($column) || empty($column))) { $emptyCount++; } } //foreach // If we have unset everything, then just remove the whole row entirely if($emptyCount == count($row)) { unset($panels[$name][$rowCount]); continue; } else if(count($row) > 2) { foreach($row as $key=>$column) { if(empty($column) || $column == '') { unset($panels[$name][$rowCount][$key]); } } } } //foreach } //foreach return $panels; } } ?>