Hi.
You are testing to see if there is a null, right?
That is, if the field
is null, you want the if to evaluate true?
If so, why do you flip the result of the if statement?
Testing this on my own, the empty function worked perfectly.
Even a simple boolean check against the empty array element worked.
The is_null function doesn't work, however. This would be due to the fact that it apparently only checks for a variable set with the NULL constant, which the fgetcsv doesn't do for empty cells.
All of this worked for me:
-
if($_v == null)
-
if(empty($_v))
-
if(!$_v);
-
If that isn't working for you, could there be a problem with the CSV data?
Edit:
Ok, so I kind of missed the point there. Was thinking about empty cells :P
But, with completely empty rows, these three still worked for me:
-
if($data[0] != null) {
-
# Show row
-
}
-
if($data[0]) {
-
# Show row
-
}
-
if(!empty($data[0])) {
-
# Show row
-
}
-