PHP 4.0 Bug #8790 Updated: set global in function
| From: | koyama at hoge dot org | Date: | Sat, 10 Mar 2001 05:30:36 +0000 |
| Subject: | PHP 4.0 Bug #8790 Updated: set global in function | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-48569@lists.php.net to get a copy of this message | ||
ID: 8790
User Update by: koyama@hoge.org
Old-Status: Open
Status: Closed
Bug Type: Scripting Engine problem
Description: set global in function
Sorry, it's my mistake.
reset() is required.
Previous Comments:
---------------------------------------------------------------------------
[2001-01-18 13:03:35] koyama@hoge.org
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:
=======================
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8790