The require_once statement is identical to require except PHP will check if the file has already been included, and if so, not include (require) it again.
See the include_once documentation for information about the _once behaviour, and how it differs from its non _once siblings.
If your code is running on multiple servers with different environments (locations from where your scripts run) the following idea may be useful to you:
a. Do not give absolute path to include files on your server.
b. Dynamically calculate the full path (absolute path)
Use a combination of dirname(__FILE__) and subsequent calls to itself until you reach to the home of your ‘/index.php’. Then, attach this variable (that contains the path) to your included files.
One of my typical example is:
<?php require_once(‘/var/www/public_html/config.php’); ?>
After this, if you copy paste your codes to another servers, it will still run, without requiring any further re-configurations.
[EDIT BY danbrown AT php DOT net: Contains a typofix (missing ‘)’) provided by ‘JoeB’ on 09-JUN-2011.]