What's The Difference Between "require Once" And "include" In Php? - Webmasters - Nairaland
Nairaland Forum › Science/Technology › Webmasters › What's The Difference Between "require Once" And "include" In Php? (7013 Views)
| What's The Difference Between "require Once" And "include" In Php? by cmon(op): 12:39pm On Sep 18, 2007 |
Please I'ld like solutions to the above topic |
| Re: What's The Difference Between "require Once" And "include" In Php? by my2cents(m): 2:00pm On Sep 18, 2007 |
include() - http://us2.php.net/manual/en/function.include.php require_once() - http://us2.php.net/require_once for all future PHP reference: http://us2.php.net/ |
| Re: What's The Difference Between "require Once" And "include" In Php? by kazey(m): 2:18pm On Sep 18, 2007 |
Dont get confuse with the _once attribute. The function is basically include() and require(). the _once attribute can be added to both. And Both actually do the same thing in regards to adding the specified file, but are different in the way they handle failures. _once is included in the respective functions to avoid problem with function redefinitions. That is preventing the file been included for evaluation or execution from been added more than once. The difference between include() and require is simply, when the specified file is called in both cases , and the file does not exist for example, the require() function returns a fatal error while the include() function, returns a warning, which means the scripts calling the function does not halt, as in the case of with the require(). so its basically, the include() function in a script would show a warning if the specified file does not exist and the require(), function would return an error and halt if the file been called for evaluation or execution does not exist for example. The require makes the file inclusion compulsory , while the include can continue with the other part of the calling script if applicable, if that specified file in the function does not exist. Looking for a host for your PHP Websites try Nairahost at Nairahost Nigeria |
| Re: What's The Difference Between "require Once" And "include" In Php? by cmon(op): 11:17pm On Sep 22, 2007 |
Thanks for your contributions. @kazey, Thanks particularly. You don't need to tell me about Nairahost cos I already have a couple of sites hosted with you guys. Keep up the good work. You've been impressive. So far. |
7 Reasons Why You Must Include Images In Blog Posts By Mediapace • What’s The Difference Between A Mobile Website And Responsive Web Design? • What Is The Difference Between A Web Designer And A Web Developer? • 2 • 3 • 4
The Journey Of A Web Developer • 7 Important Features Every Website Must Have To Be Effective • How To Design A Professional Website Using Dreamweaver