I know the basic usage of PHP require, require once, include and include once. But I am confused about when I should use them.
Example: I have 3 files, eg: settings.
include() Fetch data and load contain in current file and also load same file more than one time.
include_once() work same as include() but we use include_once() if a file has already been included, it will not be included again.
if use same file as multiple time in Like:- include_once 'setting.php'; use second time include_once 'settting.php'; ignore them.
require() work same as include().
require_once() if file has already included, it will not be included again.
include() and include_once() produce warning and script will continue.
require() and require_once() produce fatel error and stop the script.
require_once() in your script.