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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
47 - 32 = ?
Subscribe to this entry?

 
 [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 27 13:01:31 2024 UTC