Difference between include() and require()
| From: | Ford, Mike [LSS] | Date: | Wed, 20 Feb 2002 17:39:47 +0000 |
| Subject: | Difference between include() and require() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-80216@lists.php.net to get a copy of this message | ||
I've just noticed that the manual's description of the difference between include() and
require() has changed some time in the last few months from:
"include() differs from require() in that the include statement is re-evaluated each time it is
encountered (and only when it is being executed), whereas the require() statement is replaced by the
required file when it is first encountered, whether the contents of the file will be evaluated or
not"
(which is reasonable) to:
"The two constructs are identical in every way except how they handle failure. include()
produces a Warning while require() results in a Fatal Error."
(which is also reasonable, although less useful).
I can find nothing in the PHP4 ChangeLog, or in the bugs database, that mentions such a change.
(1) Has this, indeed, changed?
(2) If so, shouldn't the ChangeLog mention it, and the manual document which version it changed
in?
(3) ... and why the change? The first behaviour seems extremely useful for not include()ing files
which aren't really needed!
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211