PHP Manual
Prev | Chapter 11. Control Structures | Next

# require_once()

The require_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the require() statement, with the only difference being that if the code from a file has already been included, it will not be included again. See the documentation for require() for more information on how this statement works.

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.

For examples on using require_once() and include_once(), look at the PEAR code included in the latest PHP source code distributions.

> Note: require_once() was added in PHP 4.0.1pl2

See also: require(), include(), include_once(), get_required_files(), get_included_files(), readfile(), and virtual().

Prev | Home | Next
include() | Up | include_once()