Snippets


/**
* Determine whether a multi-dimensional array is considered to be empty.
* 
* @author kleingeist
* @param mixed $mixed Array or variable to be checked.
* @return bool Returns FALSE if mixed has a non-empty and non-zero value. 
* @link http://php.net/manual/en/function.empty.php
*/
function array_empty($mixed) {
  if (is_array($mixed)) {
    foreach ($mixed as $value) {
      if (!array_empty($value)) {
        return false;
      }
    }
  }
  elseif (!empty($mixed)) {
    return false;
  }
  return true;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>