php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #29866 Why isn't there a $_GLOBAL
Submitted: 2004-08-27 13:55 UTC Modified: 2004-08-27 13:57 UTC
Votes:3
Avg. Score:3.0 ± 1.6
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: reimer at webhostingtech dot de Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: reimer at webhostingtech dot de
New email:
PHP Version: OS:

 

 [2004-08-27 13:55 UTC] reimer at webhostingtech dot de
Description:
------------
This is not bug, but a feature request. Since the release 4.1 we all use $_POST, $_GET, $_SESSION etc. for our scripting. I was just wondering why we do not use $_GLOBALS to access variables outside the class or function. 

I think this would fit better than $GLOBALS :)

Reproduce code:
---------------
<?
$_REQUEST["foo"] = "foo";
$foo = "foo";

function foo() {
 echo $_REQUEST["foo"]; // Works
 echo $GLOBALS["foo"]; // Works
 echo $GLOBALS["foo"]; // Does not work
}
?>

Expected result:
----------------
Prints foos and an error.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-27 13:57 UTC] derick@php.net
We're not perl ;-) and therefore are not going to create another way of accessing globals while $GLOBALS perfectly does what we need.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 12:01:31 2024 UTC