With PHP 5.3, you could probably use a Closure,
You could use use keyword to pass parameter.
Method 1.
Method 2:
You can use any method, you found easy.
You could use use keyword to pass parameter.
Method 1.
function outer()
{
$l = "xyz";
$inner = function () use ($l)
{
var_dump($l);
};
$inner();
}
outer();
Method 2:
function outer()
{
$l = "...";
function inner($l)
{
// print $l
}
inner($l);
}
outer();
You can use any method, you found easy.