Check If array is null or not in php

后端 未结 6 1114
庸人自扰
庸人自扰 2020-12-16 12:15

I have an array like below which is generated by parsing a xml url.

The array is

Array
  (
 [Tags] => SimpleXMLElement Object
    (
        [0] =         


        
6条回答
  •  被撕碎了的回忆
    2020-12-16 13:01

    if array is look like this [null] or [null, null] or [null, null, null, ...]

    you can use implode:

    implode is use for convert array to string.

    if(implode(null,$arr)==null){
         //$arr is empty
    }else{
         //$arr has some value rather than null
    }
    

提交回复
热议问题