For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > July 2004 > #29429 [Opn->Bgs]: unset( $GLOBALS['foo']); unset only global variable, not variab









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #29429 [Opn->Bgs]: unset( $GLOBALS['foo']); unset only global variable, not variab
tony2001@php.net

2004-07-29, 8:55 am

ID: 29429
Updated by: tony2001@php.net
Reported By: kingoleg at mail dot ru
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: All
PHP Version: 4.3.8
New Comment:

Then it's a bogus docu problem.



Previous Comments:
------------------------------------------------------------------------

[2004-07-29 09:44:18] kingoleg at mail dot ru

Doc problem about this http://bugs.php.net/?id=29428 was closed with
bogus status :)

------------------------------------------------------------------------

[2004-07-29 09:23:59] tony2001@php.net

It's a docu problem, not a bug.

------------------------------------------------------------------------

[2004-07-28 15:05:56] kingoleg at mail dot ru

Description:
------------
unset( $GLOBALS['foo']); unset only global variable, not variables that
REFERED to global variable

How we can unset global variable with all referenced variable using
unset() function? Do we must user assign to null?

Reproduce code:
---------------
<?php
function a( &$foo) {
$foo = 'ok';
b( $foo);
var_dump( $foo);
}

function b( &$foo) {
$foo = 'not ok';
unset( $GLOBALS['foo']);
}

global $foo;
$foo = 'global';
a($foo);
var_dump( $foo);

?>

Expected result:
----------------
NULL NULL

Actual result:
--------------
string(6) "not ok" NULL


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=29429&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com