It’s available in PHP 4, 5, and 7.
bool require_once( string $file );
This construct loads the specified file if that file exists. It will only load it one time. Therefore, if it’s called again, it checks in memory to determine if the file has already been loaded previously.
include, if the file does not exist, then a fatal
E_COMPILE_ERROR error is thrown, which will halt the program from continuing.
The path can be omitted. In this case, PHP will search in the same directory for the file.
If the path is provided, whether it’s an absolute or relative path, PHP searches based upon that path.
The code contained within the loaded file will inherit the local variable scope on the line where it’s loaded.
- The file to be loaded.
This function a
You will grow in this profession when you incrementally and systematically stretch yourself....bit-by-bit.
More coming soon…keep checking back.