Use Function local variablescope in PHP
Description
The following code shows how to use Function local variablescope.
Example
/*from w ww . ja va 2 s . com*/
<?php
function assignName()
{
$name = "Zeev";
echo $name;
}
$name = "Leon";
echo $name;
assignName();
//prints Leon
print($name);
?>
The code above generates the following result.