Is there a way to check if all the elements in an array are null in PHP?
For instance, I have an array array(null,null,null,null) – is there a way to check this scenario?
I am looking for a better way than just looping through the entire array and checking each element.
Another simple way of making this work is to use the
max()function.Thus you can issue a simple
if( is_null(max($array)) ) { ... }call.