note 69611 added to language.variables.scope
| From: | alan at osu1 dot php dot net | Date: | Tue, 12 Sep 2006 17:53:50 +0000 |
| Subject: | note 69611 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117073@lists.php.net to get a copy of this message | ||
Using the global keyword inside a function to define a variable is essentially the same as passing
the variable by reference as a parameter:
somefunction(){
global $var;
}
is the same as:
somefunction(& $a) {
}
The advantage to using the keyword is if you have a long list of variables needed by the function -
you dont have to pass them every time you call the function.
----
Server IP: 64.71.164.2
Probable Submitter: 198.151.217.26
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- https://master.php.net/note/edit/69611
Del: integrated -- https://master.php.net/note/delete/69611/integrated
Del: useless -- https://master.php.net/note/delete/69611/useless
Del: bad code -- https://master.php.net/note/delete/69611/bad+code
Del: spam -- https://master.php.net/note/delete/69611/spam
Del: non-english -- https://master.php.net/note/delete/69611/non-english
Del: in docs -- https://master.php.net/note/delete/69611/in+docs
Del: other reasons-- https://master.php.net/note/delete/69611
Reject -- https://master.php.net/note/reject/69611
Search -- https://master.php.net/manage/user-notes.php