Bug #691: $GLOBALS does not work with array elements
| From: | charly at openware dot com dot ar | Date: | Tue, 25 Aug 1998 02:05:50 +0000 |
| Subject: | Bug #691: $GLOBALS does not work with array elements | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-560@lists.php.net to get a copy of this message | ||
From: charly@openware.com.ar
Operating system: SCO OSE 5.0.2
PHP version: 3.0.3
PHP Bug Type: Other
Bug description:
Hi. I have the following piece of code:
===========
function pp( $var ) {
echo $GLOBALS[$var];
}
$ab= "hello";
echo pp( "ab" );
===========
This returns "hello".
But, the following piece of code does not work.
===========
function pp( $var ) {
echo $GLOBALS[$var];
}
$ab[1]= "hello"; <- I've added [1]
echo pp( "ab[1]" ); <- also here
===========
This returns "".
I have also tryied with a little different code.
===========
function pp( $var ) {
global $$var;
echo "${$var}";
}
$ab= "hello";
echo pp( "ab" );
===========
This returns "hello".
But it does not work too with an array element like this:
===========
function pp( $var ) {
global $$var;
echo "${$var}";
}
$ab[1]= "hello";
echo pp( "ab[1]" );
===========
This returns "".
I've looked for a bug in the bug database but I didn't found one. Excuse me it is not a
bug.
Regards, Carlos.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net