Calls an external script to execute, if it has not already been called.
include_once() is very similar to include(), but is used when there is a risk that including a file more than once will lead to conflicts. This function guarantees that a file is not included more than once during the same execution of a script.
<?php
/////////////////////////////
// helloworld.php
// --------------
//
// print "Hello World<br>";
//
/////////////////////////////
for ($i = 0; $i < 10; $i++) {
include_once("helloworld.php");
}
?>
Hello World
Even though helloworld.php is included multiple times in a loop, it is only executed once.