* Thus wrote Mag:
> I did look at the fopen option...but it just seemed a
> little longer and more complicated to do that plus
> according to this benchmark
> (http://force-elite.com/~chip/projects/php/benchmarks/file-vs-fgets/)
> using file_get_contents is upto 6 times faster (?) in
> some cases..

You certaintly dont want to do a file() on a 20MB file.  There are
times when you'll want to use fopen vs file/file_get_contents. 

file_get_contents will be much faster for a couple of reasons. for
one, getting the same results as file_get_contents you have to do
something like:
  $string = implode("\n", file($file));

Another reson file_get_contents() will be faster is because it uses
(when available on the OS) a special memory allocation that is much
more efficiant, than other file reading tools.


Curt
-- 
Quoth the Raven, "Nevermore."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to