function filter_array($arr, $values = ['',[]]){ foreach ($arr as $k => $v) { if (is_array($v) && count($v)>0) { $arr[$k] = filter_array($v, $values); } foreach ($values as $value) { if ($v === $value) { unset($arr[$k]); break; } } } return $arr; }