PHP 4.0 Bug #4582: `unset' removes the effect of `global'

From: Date: Wed, 24 May 2000 18:20:54 +0000
Subject: PHP 4.0 Bug #4582: `unset' removes the effect of `global'
Groups: php.dev 
Request: Send a blank email to php-dev+get-19396@lists.php.net to get a copy of this message
From: massaro@ime.usp.br Operating system: Linux PHP version: 4.0.0 Release PHP Bug Type: Scripting Engine problem Bug description: unset' removes the effect of global' <?php function change() { global $var; unset($var); $var = 'after'; } $var = 'before'; change(); print $var . "<br>\n"; ?> PHP3 prints "after", but PHP4 prints "before". If the line "unset($var);" in the function is removed, both print "after". Looks like unset' is removing the effect of the global'.

« previous php.dev (#19396) next »