<?php
$age = 25
function getAge(){
echo $age;
}
getAge();
/* Output will be error , because we have $age variable out of the function and it isn't global variable.If we want to function has output we need to add a global variable (global $age ) to the function */
?>
<?php
//exapmle of global variable
$age = 25
function getAge(){
global $age;
echo $age;
}
getAge();
//output will be 25
?>