fscanf and memory
| From: | Sébastien Guay | Date: | Thu, 26 Feb 2004 18:48:20 +0000 |
| Subject: | fscanf and memory | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-178953@lists.php.net to get a copy of this message | ||
Hi,
I don't know if it's a bug in php but if I do
$fp=fopen("some_file","r");
while (!feof($fp))
{
fscanf($fp, "%d %d",&$var1,&$var2);
// some treatment
}
fclose($fp);
and the file is big enough, php eat up memory like hot cakes.
But if I do
$fp=fopen("some_file","r");
while (!feof($fp))
{
$line = fscanf($fp, "%d %d");
list ($var1, $var2) = $line;
// some treatment
}
fclose($fp);
It work just fine. Seems a problem with fscanf.
Has someone ever experienced this? Any advises?
Oh btw I'm using php 4.3.4 with Apache 1.3.29
Thanks in advance
Sébastien Guay
_________________________________________________________________
MSN Search, le moteur de recherche qui pense comme vous ! http://fr.ca.search.msn.com/