include_once and require_once will only include a file once : include_once « Utility Function « PHP






include_once and require_once will only include a file once

 
//bar.php:

    <?php
            print "In bar\n";
    ?>

//index.php
    <?php
            include_once 'bar.php';
            include_once 'BAR.php';
            include_once 'Bar.php';
    ?>
  
  








Related examples in the same category

1.include_once() function verifies whether or not the file has already been included.
2.Using include_once to include a file