[thelist] Force same PHP include several times on a page

Matt McKeon matt at camadro.com
Fri Apr 25 08:16:27 CDT 2008


Stefan Schwarzer wrote:
> Hi there,
> 
> it seems PHP5 is handling a file include differently than PHP4. I just  
> migrated, and in one of my apps, I have an include for a specific PHP  
> file (which loads a couple of complex SQL query builds) several times  
> on the same page. I guess it's not very efficient; instead it would be  
> wiser to build a function instead. But.... don't want to touch the  
> code for the moment.
> 
> Now, with PHP4, it loads the include only once. But ignores the other  
> include-commands.
> 
> Anything I can do about?
> 
> Thanks for any hints!
> 
> Stef
> 
>

You probably should check out include_once() 
<http://us.php.net/manual/en/function.include-once.php>

HTH
Matt



More information about the thelist mailing list