Reply to Re: PHP read large file line by line?

Your name:

Reply:


Posted by Jerry Stuckle on 10/13/06 18:00

ZabMilenko wrote:
>
> $file_array = file($file_name);
>
> foreach ($file_array as $line_number => $line)
> {
> // Handle the line
> }
>
>
>
> See: http://us3.php.net/manual/en/function.file.php
>
>
> howa wrote:
>
>> hi,
>>
>> how to read a large php file line by line?
>>
>> fread can't?
>>
>> thanks.
>>

The problem with your solution is it reads the entire file into the
array. Note he said LARGE FILE. This could very quickly run him out of
memory.

Ikciu has the correct answer. fgets() is the way to go.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация