Re: [PHP] Simple reading a file and extract fields

2007-11-13 Thread Jochem Maas
Ronald Wiplinger wrote: > I got a larger file which consists of lines with a defined length of 56 how large? for very big files it's dangerous to read them in all at once, as was exampled in other replies. I would say that large in this case would be anything bigger than 5 Mb (this is a very rough

Re: [PHP] Simple reading a file and extract fields

2007-11-13 Thread David Calkins
The fgets() function only reads a single line from the file. See the below link for a way to read through all lines in the file. Then after reading each line, use substr to pull out the fields. http://us.php.net/manual/en/function.fgets.php On Nov 13, 2007 8:53 AM, Ronald Wiplinger <[EMAIL PRO

[PHP] Simple reading a file and extract fields

2007-11-13 Thread Ronald Wiplinger
I got a larger file which consists of lines with a defined length of 56 characters. Each line ends with a line feed (0A), >From each line I want one field from position 1 ~ 5 and field 2 from position 7 ~ 46. I tried: $myFile = "plaiso"; $fh = fopen($myFile, 'r'); $theDataLine = explode("\n",fge