Hi I have this problem.
I have a .csv that I want to validate, non of the variables can be null.
If my .csv is
A;ABC;
A;A;
A;A;
A;A;
And the php that read this file looks like:
$fd = fopen("uploads/".$nombreArchivo,"r");
while (!feof($fd)){
$lineTexto++;
$reg = fgets($fd);
$arreglo = explode(";", $reg);
if(count($arreglo)==3){
if(!$arreglo[2]){
$_SESSION["info"]=$_SESSION["info"]."The cell 3 of the line $lineTexto can not be null<br/>";
}
}
else{
$_SESSION["info"]=$_SESSION["info"]."Número de líneas incorrectos en la linea $lineTexto<br/>";
}
}
The result is
The cell 3 of the line 4 can not be null
What about all the other lines that have a linebreak, but they are null?
Thanks for your time.
They are not null .. the issue is that they contain empty space and you can resolve this by using
trimExample Output