note 86149 added to language.variables.superglobals
| From: | Tiborrocketmachine dot com at osu1 dot php dot net | Date: | Mon, 06 Oct 2008 05:00:11 +0000 |
| Subject: | note 86149 added to language.variables.superglobals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145077@lists.php.net to get a copy of this message | ||
You can use superglobals to make your variables available everywhere without declaring them global.
<?php
$_ENV['mystring'] = 'Hello World';
$_ENV['myarray'] = array('Alpha', 'Bravo', 'Charlie');
function test() {
print $_ENV['mystring'];
print_r($_ENV['myarray']);
}
test();
?>
----
Server IP: 69.147.83.197
Probable Submitter: 65.95.120.192
----
Manual Page -- http://www.php.net/manual/en/language.variables.superglobals.php
Edit -- https://master.php.net/note/edit/86149
Del: integrated -- https://master.php.net/note/delete/86149/integrated
Del: useless -- https://master.php.net/note/delete/86149/useless
Del: bad code -- https://master.php.net/note/delete/86149/bad+code
Del: spam -- https://master.php.net/note/delete/86149/spam
Del: non-english -- https://master.php.net/note/delete/86149/non-english
Del: in docs -- https://master.php.net/note/delete/86149/in+docs
Del: other reasons-- https://master.php.net/note/delete/86149
Reject -- https://master.php.net/note/reject/86149
Search -- https://master.php.net/manage/user-notes.php