Check the documentation:
Returns an indexed array containing the fields read on success, or false on failure.
The error message tells us that the function returned
false
, meaning that it failed to parse the current line as CSV.
You need to check the content of your file to see why the function is failing. If you want to ignore invalid lines, check that the function did not return
false
before trying to
foreach
over the return value.
Quote:
if ($item == $Zipcode && $item == $Housenumber)
As discussed in the comments, the only way the
$item
variable can be equal to both the
$Zipcode
and
$Housenumber
variables at the same time is if the
$Zipcode
and
$Housenumber
variables contain the same value.
If you want to test whether the item is equal to either of the user inputs, as your comment suggests, you need to use
OR, not
AND:
if ($item == $Zipcode || $item == $Housenumber)
Quote:
$item is the first row of the csv for some reason??
According to the documentation, the
$item
variable should be an array of the fields extracted from the current row of the CSV file. If that's not the case, then there's something wrong with your CSV file.
Since we don't have access to your file, you're going to need to check the contents of the file yourself.