Re: require v. includes
| From: | Joshua E Minnie | Date: | Thu, 07 Mar 2002 19:22:29 +0000 |
| Subject: | Re: require v. includes | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87671@lists.php.net to get a copy of this message | ||
Thanks for the information, was definitely very helpful in clearing up that
question.
Joshua E Minnie
josh@acsurf.net
"Don't work for recognition, but always do work worthy of recognition." ~
Unknown
"Michael Kimsal" <michael@tapinternet.com> wrote in message
news:3C87AE9C.7000405@tapinternet.com...
> Joshua E Minnie wrote:
> > I was just wondering if anyone could tell me when would be the time to
> > choose require(), require_once(), or include(). I know a little bit
about
> > using each one, but I am just not sure if there is one that is better
than
> > the other in certain situations.
> >
>
>
> For all intents and purposes there's no real difference between the two.
>
>
> From the manual:
> require() and include() are identical in every way except how they
> handle failure. include() produces a Warning while require() results in
> a Fatal Error. In other words, don't hesitate to use require() if you
> want a missing file to halt processing of the page. include() does not
> behave this way, the script will continue regardless. Be sure to have an
> appropriate include_path setting as well.
>
> require_once() should be used in cases where the same file might be
> included and evaluated more than once during a particular execution of a
> script, and you want to be sure that it is included exactly once to
> avoid problems with function redefinitions, variable value
> reassignments, etc.
>
> include_once() should be used in cases where the same file might be
> included and evaluated more than once during a particular execution of a
> script, and you want to be sure that it is included exactly once to
> avoid problems with function redefinitions, variable value
> reassignments, etc.
>
>
>
> Michael Kimsal
> http://www.phphelpdesk.com
> Taking the ? out of <?php
> 734-480-9961
>