Hi,
I am currently reading in a DAT file (seperated by "|") in to an array using PHP. What I need to do is to read a whole line until I hit a line break... an example of the data is:
matt | facer | | | yes | | 12
James | clarke | 23 seal rd | | no | often | 12
so is it possible to read in the line and output it, then read the next line??
My PHP looks like this so far:
$file = "files.dat";
$whattoread = @fopen($file, "r") or die("Could not find file");
$filecontents = fread($whattoread, filesize($file));
$data = array();
$data = explode("|", $filecontents);
$cExts = count($data);
for ($i=0;$i<=($cExts-1);$i++)
{
echo "$data[$i]\n";
}
So I need some sort of loop saying "do while there is no line break" Then once the code hits a line break it outputs the array, clears it, and reads the next line! or something like that... maybe I could use a 3d array? can this be done?!
cheers !!