|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #738 $GLOBALS dislike array element and class field
Submitted: 1998-09-11 13:35 UTC Modified: 1998-09-25 19:52 UTC
From: mquinson at zeppelin-cb dot de Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.3 OS: win95 ; freeBSD
Private report: No CVE-ID: None
 [1998-09-11 13:35 UTC] mquinson at zeppelin-cb dot de
(is it a bug or an improvement?)

I create
class test {
	var $value;
	function test() {
		$this->value = 2;
}	}
$myTest = new test();
And then, if I try to access to $GLOBALS["myTest->value"], i get an empty string.
and I would like to get $myTest->value...
To fix it, i have to ereg("^([a-zA-Z0-9_-]*)->([a-zA-Z0-9_-]*)",$name,$regs) all the strings I want to pass to $GLOBALS. It's not so usefull... 

The same is true with $GLOBALS["foo[0]"];

Thanks for your time.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-09-25 19:52 UTC] zeev
You only have the syntax wrong.
To access $foo[0] in the global scope, you need to access
To access $foo->bar in the global scope, you need to access

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 05:01:30 2024 UTC