Entry
Optimice access to files of strings
Jul 19th, 1999 17:42
Julio Garcia,
Well you generally acces to a file database or logs file with a code...
$fp=fopen($filename,"r");
while (!feof($fp)):
$line=fgets($fp,2000);
//Process line
echo $line;
endwhile;
You can optimice code with...
$fp=fopen($filename,"r");
$contents = fread( $fp, filesize( $flename ) );
fclose($fp);
$line=explode("\n",$contents);
$cont=count($line);
for($n1=0;$n1<$cont;$n1++)
{
//Process line REMEMBER ACCEES WITH ARRAY INDEX
echo $line[$n1];
}
¿Limit.... I process files of 5 Mb...