/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<? function array_non_empty_items($input) { // If it is an element, then just return it return $input; } 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; } ?>