PHP 4.0 Bug #8790: set global in function

From: Date: Thu, 18 Jan 2001 18:03:35 +0000
Subject: PHP 4.0 Bug #8790: set global in function
Groups: php.dev 
Request: Send a blank email to php-dev+get-44503@lists.php.net to get a copy of this message
From: koyama@hoge.org Operating system: FreeBSD-4.1 PHP version: 4.0.3pl1 PHP Bug Type: Scripting Engine problem Bug description: set global in function If set global variables as global in function, first time works fine, but second wrong. ======================= <?php $hoge = 'hoge'; function a() { while (list($name,) = each( $GLOBALS )) { global $$name; } echo "hoge: $hoge<br>\n"; } a(); a(); a(); ?> ======================= It displays ======================= hoge: hoge hoge: hoge: ======================= -- Edit Bug report at: http://bugs.php.net/?id=8790&edit=1

« previous php.dev (#44503) next »