php - How to check if $array = array(1) { [""]=> NULL } is true or false -
i have addon case array gets on var_dump($array)
:
array(1) { [""]=> null }
how can check if true or false? if array set e.g.
array(1) { ["test"]=> string(2) "test" }
i tried
if ($array == null) if ($array[""] == null) if ($array[""] == "null") if ($array == "null")
"" array-index little bit scary ...
since $array[0] first element won't work, try figure out if array nodes null:
$fillcount = 0; foreach ($arrdata $key => $value) { if (!is_null($value)) $fillcount++; } if ($fillcount <= 0) { // nothing useful in array } else { // useful content in array }
Comments
Post a Comment