Hi,
I am trying to read a file but I have a problem because it is read in the end an empty line (this line does not exist)
My code is
$file_handle = fopen($newFilewithFolder, "r")
or exit("problem.");
$getfileInfo = fgetcsv($file_handle);
$numcols = count($getfileInfo);
// my file is opened again and I have read a line so
// I use fseek to set in the beginning of file
fseek($file_handle, 0);
$lineCounter=0;
while (!feof ($file_handle))
{
$buffer = fgetcsv($file_handle, 4096);
print_r($buffer);
echo "<br>";
for ($i = 0; $i < 24; ++$i)
{
if ($buffer[$i] == "")
$buffer[$i] = " ";
}
$sex=$buffer[0];
$age=$buffer[1];
$pain=$buffer[2];
//....
$diseaseFile=$buffer[23];
exec('java -jar program.jar '.$sex.' '.$age.' '.$pain.' ',......, $output);
$rule_disease = explode(": ", $output[1]);
$ruleFired = $rule_disease[0];
$disease = $rule_disease[1];
$lineCounter++;
echo "<b>Line ".$lineCounter." : File(".$diseaseFile.")\t Jess(".$disease.")</b><br>";
what am I doing wrong ?
Thanks in advance