FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Repetetive code question
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Repetetive code question [message #179645 is a reply to message #179632] Thu, 15 November 2012 15:29 Go to previous message
Christoph Becker is currently offline  Christoph Becker
Messages: 91
Registered: June 2012
Karma:
Member
<Dynamo> wrote:
> [
> <?php
> $mymenu=file_get_contents('menu.txt');
> echo $mymenu;
> ?>
> ]
> Everthing works fine but is this good practice and is there a better
> way.

The equivalent to echo file_get_contents('filename') is
readfile('filename'). The benefit over file_get_contents() is, that it
doesn't need to load the complete file into memory. The benefit over
include() & al. is, that it's faster, as the file doesn't have to be parsed.

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Scrape dynamically generated hyperlinks
Next Topic: PHP 5.5 and Windows XP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 04:58:07 GMT 2024

Total time taken to generate the page: 0.19078 seconds