Re: How PHP handles multiple inclusions of the same file?

From: Date: Mon, 09 Aug 2004 00:48:15 +0000
Subject: Re: How PHP handles multiple inclusions of the same file?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-193155@lists.php.net to get a copy of this message
Gambler ZG wrote:
Let’s say I have function named "render", which looks like this: <?php function render($template, $vars){
    extract($vars);
    include("templates/".$template.'.php');
} ?> I also have template "some_tmplt.php", which I need to render 100 times. Will PHP read, parse and compile this file 100 times, or will it "remember" file's content? not sure if i understnad your question. If you want to cache the compiled php script look at Turck MMCache. If you want to avoid the same file being included twice in your script look at include_once() or require_once()
-- Raditha Dissanayake. ------------------------------------------------------------------------ http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar.

« previous php.general (#193155) next »