The include statement allows you to include and attach other PHP scripts to your own script. You can think of it as a simply taking the included file and inserting them into your PHP file.
For example:
<?php
function add ($x, $y)
{
return $x + $y;
}
?>
Using include function:
<?php
include (‘add.php’);
echo add (2,2);
?>
The execution of above given program will produce 4
In part 1 & part 2 of above given example, the Include statement has attached other PHP script. This is how you can access other variables, functions etc.



