The code illustrates better what I\'m asking:
function foo(){
$var = get_huge_amount_of_data();
return $var[0];
}
$s = foo();
// is memory freed her
You can see this example on a class, that's because you can "catch" freeing a variable in class' destructor:
class a {
function __destruct(){
echo "destructor
";
}
}
function b(){ // test function
$c=new a();
echo 'exit from function b()
';
}
echo "before b()
";
b();
echo "after b()
";
die();
This script outputs:
before b()
exit from function b()
destructor
after b()
So it is now clear that variables are destroyed at function exit.