The scope of a variable is the part of the script where the variable can be referenced/used.
PHP has four different variable scopes:
local
global
static
parameter
Variables: When internal function variables access global variables, you need to add global:
Example:
<?php
$x=10;
$y=23;
function add(){
global $x,$y;
$y=$x+$y;
}
add();
echo $y;
?>