RE: [PHP] Include and require
| From: | Philip Olson | Date: | Thu, 03 May 2001 18:18:08 +0000 |
| Subject: | RE: [PHP] Include and require | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51305@lists.php.net to get a copy of this message | ||
for a lengthy post on the subject that clearly explains the
differences/similarities/history between require and include, see this
post by Zeev :
RE: [PHP] Require() vs Include()
------------------------------------------------------------
http://marc.theaimsgroup.com/?l=php-general&m=97419027907315
regards,
philip
On Thu, 3 May 2001, Johnson, Kirk wrote:
> > According to the docu u should not require() files or
> > external code in loops
> > or u must use curly Bracket when used in if conditions.
> >
> > But everythink works fine. I require() successfully in for
> > loops, I can use
> > it in if..elseif..else constucts without curly brackets.
> > (only one line of
> > cause)
> >
> > So where is the difference between require() and include().
>
> It depends on how you are using it. If you want what you are require()'ing
> to *vary* on each loop iteration, you must use include(). A require() is
> only executed once, during the initial parse of the file. An include() gets
> re-evaluated on each loop iteration, so you can vary the filename, etc. See
> http://www.php.net/manual/en/function.require.php for more.
>
> Kirk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>