Whenever you are using require_once()
can be use in a file to include another file when you need the called file only a single time in the current file.
Here in the example I have an test1.php.
<?php
echo "today is:".date("Y-m-d");
?>
and in another file that I have named test2.php
<?php
require_once('test1.php');
require_once('test1.php');
?>
as you are watching the m requiring the the test1 file twice but the file will include the test1 once and for calling at the second time this will be ignored. And without halting will display the output a single time.
Whenever you are using 'include_once()` can be used in a file to include another file when you need the called file more than once in the current file. Here in the example I have a file named test3.php.
<?php
echo "today is:".date("Y-m-d");
?>
And in another file that I have named test4.php
<?php
include_once('test3.php');
include_once('test3.php');
?>
as you are watching the m including the test3 file will include the file a single time but halt the further execution.