Hello,
I am pretty new to php and have been trying to figure out how to read this comma seperated txt file and return in it in a csv file. The problem I run into is when lines in the txt file are different lengths.
Here is an example of the code I have been using. This is coming from a upload form.
$fp = file("$upfile");
for($i=0; $i < count($fp); $i++)
{
echo $tmp[1] .','. $tmp[17].','. $tmp[0].','. $tmp[2].','. $tmp[0].','. $tmp[1].','. $tmp[7].','. $tmp[8] .'<br />';
}
The this works great as long as the line is only 17 places long. Any suggestions would be greatly appreciated. I have been searching everywhere without any luck.
thanks,
Kyle