note 59562 added to language.references
| From: | php-general at lists dot php dot net | Date: | Fri, 09 Dec 2005 17:43:21 +0000 |
| Subject: | note 59562 added to language.references | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99858@lists.php.net to get a copy of this message | ||
The comparison between unix filenames and the claim that PHP has garbage collection might mislead
you into thinking that variable data is kept in memory until it becomes inaccesible by any
reference. This would make the code
<?php
function example() {
global $bar;
$foo='hello!';
$bar =& $foo;
}
$bar='';
example();
echo $bar;
?>
output 'hello!'. Actually it outputs nothing! That's because the $foo is removed from
memory as soon as control leaves the function example(). The global reference $bar then points to an
undefined variable.
References are thus 'weak', they are not real references, just symbolic aliases. No
general-graph based garbage collection is performed.
----
Manual Page -- http://www.php.net/manual/en/language.references.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59562
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59562&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59562&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59562&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59562&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59562&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59562&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59562&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59562&report=yes
Search -- http://master.php.net/manage/user-notes.php