This is a discussion on What is the difference between require, include and include_once? within the PHP Programming forums, part of the Web Development category; Hi there.. what's the difference between require, include and include_once?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hi there.. what's the difference between require, include and include_once?
__________________ cheers Aman |
|
#2
| |||
| |||
| 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. The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. As the name suggests, it will be included just once
__________________ Nasee True Faith never Fails |
|
#3
| |||
| |||
| Difference between require, include and include_once? include will include the file, and should it fail, keep running the script. require will include the file, and should it fail, the script will stop. include_once and require_once are even more handy if you write scripts that run and include each other, because including() a file more than once will generate errors, but include_once() will only include the file once, regardless of how many times it is called. ThankQ KiruthikaSambandam |
|
#4
| |||
| |||
| Hi, require_once() and include_once() are both the functions to include and evaluate the specified file only once. If the specified file is included previous to the present call occurrence, it will not be done again. But require() and include() will do it as many times they are asked to do. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Difference between#include< >and#include" " | vigneshgets | C and C++ Programming | 1 | 08-01-2007 10:41 PM |
| Explain the difference between use and require. | vadivelanvaidyanathan | Perl | 1 | 07-30-2007 06:39 AM |
| What is the difference between require_once(), require(), include()? | devarajan.v | PHP Programming | 2 | 07-30-2007 04:57 AM |
| require_once(), require(), include() | sivakumar | PHP Programming | 1 | 07-16-2007 06:39 AM |
| PHP: include & require, what is different? | montyauto | PHP Programming | 2 | 06-30-2007 12:17 AM |
Our Partners |