best way to check a empty array?

后端 未结 11 1148
难免孤独
难免孤独 2020-11-30 10:16

How can I check an array recursively for empty content like this example:

Array
(
    [product_data] => Array
        (
            [0] => Array
               


        
11条回答
  •  余生分开走
    2020-11-30 10:51

    If your array is only one level deep you can also do:

    if (strlen(implode('', $array)) == 0)
    

    Works in most cases :)

提交回复
热议问题