您的位置:首页 > 编程语言 > PHP开发

PHP判断无穷级数组是否为空

2010-04-07 21:06 316 查看
PHP判断无穷级数组是否为空,数组的元素可以同时为数组和其他
  

function printArrContents($arr) {
   if(is_array($arr)) {
    foreach ($arr as $key=>$value){
     if(is_array($value)) {
      $strTmp .= printArrContents($value);
     } else {
      $strTmp .= $value;
     }
    }
    } else {
    $strTmp .= $arr;
    }
     return $strTmp;
  }
  
  function arrIsEmpty($arr) {
   $tmp = str_replace(' ','',printArrContents($arr));
   if(is_null($tmp) || '' == $tmp) {
   //if(empty($tmp)) {
    echo '数组为空!';
   } else {
    echo '数组不为空!';
   }
  }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php function null