ID: 29428 Updated by: [EMAIL PROTECTED] Reported By: kingoleg at mail dot ru -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: All PHP Version: Irrelevant New Comment:
It's described pretty well, there's even example on this. Assigning null is slightly different from unsetting (e.g. variable stays in parent array with null value). Previous Comments: ------------------------------------------------------------------------ [2004-07-28 14:07:32] kingoleg at mail dot ru Description: ------------ In http://ua2.php.net/unset nothing said about how work unset() on local variables (PASSED BY REFERENCE or NOT). unset() always "destroy" variables in local area. See code 1. May be would be good to write, that for variable PASSED BY REFERENCE we can use operation = null to unset variable. See code 2. Reproduce code: --------------- <?php function a() { $foo = 'ok'; b($foo); var_dump($foo); } function b(&$foo) { $foo = 'not ok'; unset($foo); } a(); ?> <?php function a() { $foo = 'ok'; b($foo); var_dump($foo); } function b(&$foo) { $foo = 'not ok'; $foo=null; } a(); var_dump($b); ?> Expected result: ---------------- For code 1. One of tree: 1. 'ok' 2. 'not ok' 3. variable $foo is null (not setted) For code 2. NULL NULL Actual result: -------------- 'not ok' NULL NULL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29428&edit=1