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
==================
Navigation:
[Reply to this message]
|