`

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

 
阅读更多

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 '数组不为空!';
}
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics