Using include_once to include a file : include_once « Utility Function « PHP






Using include_once to include a file

 
A sample include file called add.php
<?php
function add( $x, $y ){

  return $x + $y;
}
?>


<?php
include_once('add.php');
include_once('add.php');
echo add(2, 2);
?>
  
  








Related examples in the same category

1.include_once and require_once will only include a file once
2.include_once() function verifies whether or not the file has already been included.