note 99958 added to language.variables.scope
| From: | donrichard at N dot O dot S dot P dot A dot M dot navmark dot com | Date: | Thu, 16 Sep 2010 16:37:29 +0000 |
| Subject: | note 99958 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172660@lists.php.net to get a copy of this message | ||
if your going to use the extract($GLOBALS) method, note that $GLOBALS is case sensitive, at least on
my machine.
so...
<?php
$a=1;
$b=2;
function myfunction(){
extract($GLOBALS); //correct
$c = $a + $b;
echo "c is " . $c;
}
myfunction();
?>
works but.....
<?php
$a=1;
$b=2;
function myfunction(){
extract($globals); //wrong
$c = $a + $b;
echo "c is " . $c;
}
?>
does not
Regards,
Don
----
Server IP: 69.147.83.197
Probable Submitter: 72.85.175.176
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- https://master.php.net/note/edit/99958
Del: integrated -- https://master.php.net/note/delete/99958/integrated
Del: useless -- https://master.php.net/note/delete/99958/useless
Del: bad code -- https://master.php.net/note/delete/99958/bad+code
Del: spam -- https://master.php.net/note/delete/99958/spam
Del: non-english -- https://master.php.net/note/delete/99958/non-english
Del: in docs -- https://master.php.net/note/delete/99958/in+docs
Del: other reasons-- https://master.php.net/note/delete/99958
Reject -- https://master.php.net/note/reject/99958
Search -- https://master.php.net/manage/user-notes.php