Include Once Statement in PHP

What is Include Once statement?

Explanation

include_once() function checks the file after execution of the file and also for the similarity in coding, if the coding is already included, it will not include the file.

Example :


b.php


<?php
echo "bbbb";
?>

TestCode.php



<?php
include 'b.php';
include_once "b.php";
?>
Result :

bbbb

In the above example the "include_once" statement will not include the file "b.php", since it already included and the code is similar for both the files.

PHP Topics


Ask Questions

Ask Question