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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 07:01:33 2025 UTC