RE: [PHP] require() vs include()
-Original Message- From: Jim Lucas [php] [mailto:[EMAIL PROTECTED]] Sent: 15 March 2002 00:55 Plus, depending on how you are calling the file. Meaning if the file name that you are calling is a static file name or dynamic file name require() and require_once() will include a file before the php parser starts its job, but this will only happen if the name isn't dynamic. In fact, I believe that what you are describing is an OLD behaviour (prior to PHP 4.0.2, in fact). However, the manual has only recently changed to document the new behaviour (and actually doesn't do it very well, yet). Now, BOTH require and include (and their _once versions) work dynamically, and the only difference is in how they report a failure. 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: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] require() vs include()
They are much the same, both include a file. To quote the PHP 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. That said I would use require_once and include_once instead of just include and require, these functions ensure the file is only included once which prevents a lot of problems. Jason -Original Message- From: David McInnis [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 4:47 PM To: [EMAIL PROTECTED] Subject: [PHP] require() vs include() Are these redundant functions or are they different? I seem to be able to use the interchangeably. David McInnis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require() vs include()
Plus, depending on how you are calling the file. Meaning if the file name that you are calling is a static file name or dynamic file name require() and require_once() will include a file before the php parser starts its job, but this will only happen if the name isn't dynamic. meaning that if you have this require(myfile.inc); //static and require($var. .inc); //dynamic the first one will be included into the before parsing and the second will wait until the parser comes along and defines the $var value. if you call require() or require_once() with a variable in the file handler name space, it will downgrade (in a way) to just working like an include() or include_once() with include() or include_once() it doesn't matter if the file handle name has a variable in it. it will always include the file after the parser starts its job. Jim Lucas www.bend.com - Original Message - From: SHEETS,JASON (Non-HP-Boise,ex1) [EMAIL PROTECTED] To: 'David McInnis' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 14, 2002 3:56 PM Subject: RE: [PHP] require() vs include() They are much the same, both include a file. To quote the PHP 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. That said I would use require_once and include_once instead of just include and require, these functions ensure the file is only included once which prevents a lot of problems. Jason -Original Message- From: David McInnis [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 4:47 PM To: [EMAIL PROTECTED] Subject: [PHP] require() vs include() Are these redundant functions or are they different? I seem to be able to use the interchangeably. David McInnis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Require vs include
Hi Check out : http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=22 Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -Original Message- From: NGUYEN DINH Quoc Huy [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 17, 2001 9:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Require vs include Hi Can someone explain me what's the difference between include() and require() ?? I did not catch the explanation in the docs. When should I use include() and when should I use require() ?? I'm not on the list so reply me to: [EMAIL PROTECTED] Thnx -- = NGUYEN DINH Quoc Huy (SnAKes) http://www.snakesbox.com/ [EMAIL PROTECTED] - ICQ# 3398187 telnet://snakesbox.com:/ -- Puissance 4 = -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]