I have PHP file where I have defined the server access variables as well as the mysql_connect
and mysql_select_db
, as this functions are regularly
Functional Work : All functions perform similar work. All functions will include and evaluates the specific file while executing the code.
Functional Difference :
include vs include_once : There is only one difference between include() and include_once(). If the code from a file has been already included then it will not be included again if we use include_once(). Means include_once() include the file only once at a time.
include vs require : if include() is not able to find a specified file on location at that time it will throw a warning however, it will not stop script execution. For the same scenario, require() will throw a fatal error and it will stop the script execution.
require vs require_once : There is only one difference between require() and require_once(). If the code from a file has been already included then it will not be included again if we use require_once(). Means require_once() include the file only once at a time.
To get the detailed knowledge with example please review these amazing articles
(1) http://www.readmyviews.com/include-vs-include-once/
(2) http://www.readmyviews.com/include-vs-require/