RE: [PHP] getting one line from file
| From: | Michael Packer | Date: | Thu, 31 Aug 2000 13:18:04 +0000 |
| Subject: | RE: [PHP] getting one line from file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14579@lists.php.net to get a copy of this message | ||
> pac@stingrayboats.com ("Michael Packer") writes:
>
>> I'm just learning PHP and have a question....in perl I used to do this:
>>
>> $info =
grep "676" /tmp/somefile.txt;
>> (i know there was only one line in the file with that number,
>>thats why it's not @info)
>>
>> i need to only get one line out of this file that is very large
>>(which is why i don't want to open it read through the file until i find
>>the correct line)...
>
> try this: :-)
>
> $info = grep "676" /tmp/somefile.txt;
well i tried this..it works, but damn it take a performance hit...do system
calls rereally effect PHP that much?
instead of instantly loading, it now takes about 2-3 seconds
any other ideas?
thanks!
pac