You are here: Any efficiency difference between fopen() etc. and file()? « PHP Programming Language « IT news, forums, messages
Any efficiency difference between fopen() etc. and file()?

Posted by Stephen Kay on 03/30/06 02:10

I'm wondering if there is any advantage one way or the other to these two
methods of reading an html file:

1. using fopen and friends:

$myFile = "http://www.example.com/page.html";
$fh = fopen($myFile, 'r');
$content1 = fread($fh, filesize($myFile));
fclose($fh);


2. using imploed, and file:

$content1 = implode('', file("http://www.example.com/page.html"));


They both seem to work equally well, but the number 1. seems to be more
robust with different file types...


Note: I can't use file_get_contents() because my ISP's PHP version is 4.1 or
so.


--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация