Am 15.03.2012 18:41, schrieb Paul Dragoonis: >>> I don't really know when PHP frees temporary variables, but my guess >>> was that they are freed when the scope is left. >> >> Each variable has a refcount, then that hits 0 it can be freed up. > > To add to that. A zval will have a refcount, so if you do $a = > someFunc(); then $a will have a refcount. > > If you do something like $a = someFunc(anotherFunc(moreFunc())), the > return values of anotherFunc() and moreFunc() will be temp stored, but > they will _not_ have a refcount because they never got assigned into a > zval like $a.
to make sure i understand this really
function myfunc()
{
$b = internal_function_with_hughe_return_value();
return false;
}
$b is freed after the function has finished
if not i should write a lot of unset() what
is not possible if you have return $b
signature.asc
Description: OpenPGP digital signature
