Jump to Navigation

002 - About require(),include(),include_once()

* require():
If there is an error pf "missing a file", this statement immediately stop processing, but include() does not behave this way, the PHP script will continue regardless.

* include():
This statement includes and evaluate the specified file during the execution of the script. If not found a file, the script will continue.

* include_once():
This is a behave similar to the include(). The difference is that if code from file has already been included, it will not be included again. This should be used in cases and so on

<?php
include "file.php";
include('somefile.txt');
include $somefile;
?>

 



Main menu 2

Story | by Dr. Radut