[PHP] Re: require v. includes

2002-03-07 Thread Michael Kimsal

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: require v. includes

2002-03-07 Thread Joshua E Minnie

Thanks for the information, was definitely very helpful in clearing up that
question.

Joshua E Minnie
[EMAIL PROTECTED]

Don't work for recognition, but always do work worthy of recognition. ~
Unknown
Michael Kimsal [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php