note 71419 modified in function.file by danbrown

From: Date: Sun, 01 Mar 2009 18:36:33 +0000
Subject: note 71419 modified in function.file by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151295@lists.php.net to get a copy of this message
Using file() for reading large text files > 10 Mb gives problems, therefore you should use this instead. It is much slower but it works fine. $lines will return an array with all the lines. <?php $handle = @fopen('yourfile...', "r"); if ($handle) { while (!feof($handle)) { $lines[] = fgets($handle, 4096); } fclose($handle); } ?> --was-- Using file() for reading large text files > 10 Mb gives problems, therefore you should use this instead. It is much slower but it works fine. $lines will return an array with all the lines. $handle = @fopen('yourfile...', "r"); if ($handle) { while (!feof($handle)) { $lines[] = fgets($handle, 4096); } fclose($handle); } http://php.net/manual/en/function.file.php

« previous php.notes (#151295) next »