The required_once() statement replaces itself with the specified file, much like the C preprocessor's #include works, and in that respect is similar to the required() statement. The main difference is that in an inclusion chain, the use of required_once() will assure that the code is added to your script only once, and avoid clashes with variable values or function names that can happen.
It is advised that you always put the complete URL in the require_once() perimeter ("http://www.yoursite.com/examplepage.php" and not just "examplepage.php") because URLs build on eachother based on their current location. If you put the entire URL in the perimeters, then the code will know exactly where to look for what code to carry over.
|