|
Posted by small on 10/15/06 23:59
I would go fgets, this will allow you to control how much of the file
you would like to do, or maybe possibly do it in batches.
On Oct 14, 4:17 am, Pedro Graca <hex...@dodgeit.com> wrote:
> [ Please don't top-post. Readhttp://www.caliburn.nl/topposting.html]
>
> ZabMilenko top-posted (corrected):
>
>
>
> > howa wrote:
> >> hi,
>
> >> how to read a large php file line by line?
>
> >> fread can't?
>
> >> thanks.
>
> > $file_array = file($file_name);
>
> > foreach ($file_array as $line_number => $line)
> > {
> > // Handle the line
> > }
>
> > See: http://us3.php.net/manual/en/function.file.phpWhat if the file is larger than memory_limit (8Mb)?
>
> http://www.php.net/manual/en/ini.core.php#ini.memory-limit
>
> fgets() is the right answer in this case.
>
> So, instead of coding with file() which works now with a 200K file,
> start with fgets and your script will not break when the file grows.
>
> http://www.php.net/fgets
>
> --
> File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Navigation:
[Reply to this message]
|