Here’s a handy code snippet which allows you to remove empty elements from an array in PHP.
<?php function ccw_remove_empty_element_from_array($data) { foreach ($data as $key => $value) { if (is_array($value)) { $data[$key] = ccw_remove_empty_element_from_array($data[$key]); } if (empty($data[$key])) { unset($data[$key]); } } return $data; }
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment