Re: Question about include_once and require_once

From: Date: Thu, 01 May 2003 13:55:42 +0000
Subject: Re: Question about include_once and require_once
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-145958@lists.php.net to get a copy of this message
Many thanks John. That clarifies it for me. John W. Holmes wrote:
The php lit is not clear, to me, exactly what is happening. Does the "once" refer to the session or to the page?
Page. It has nothing to do with sessions. So if you have include_once('functions.php') in your code twice, the 'functions.php' code will only be parsed once with the first include_once() call.
In other words: suppose I have a file with several functions and
several
pages on my site. My visitors can arrive at any page and then
navigate
around the site. If I use include_once () on all my php pages, can I rely on the session manager to maintain the functions for the
visitors? No. Not sure where you got this from, but sessions are a completely different topic.
If I use just plain "include ()", does the php parser load up an additional copy for every time it's called?
It will parse the include file each time include() is called. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/


« previous php.general (#145958) next »