note 72605 added to language.variables.scope
| From: | Rohan at osu1 dot php dot net | Date: | Thu, 25 Jan 2007 18:11:58 +0000 |
| Subject: | note 72605 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122203@lists.php.net to get a copy of this message | ||
<?php
$a = 20;
function myfunction($b){
$a=30; //Local Variable
global $a,$c; //here global $a overrides the local
return $c=($b+$a);
}
print myfunction(40)+$c;
?>
The output of this function will be 120.
----
Server IP: 83.138.144.80
Probable Submitter: 82.153.144.238
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- https://master.php.net/note/edit/72605
Del: integrated -- https://master.php.net/note/delete/72605/integrated
Del: useless -- https://master.php.net/note/delete/72605/useless
Del: bad code -- https://master.php.net/note/delete/72605/bad+code
Del: spam -- https://master.php.net/note/delete/72605/spam
Del: non-english -- https://master.php.net/note/delete/72605/non-english
Del: in docs -- https://master.php.net/note/delete/72605/in+docs
Del: other reasons-- https://master.php.net/note/delete/72605
Reject -- https://master.php.net/note/reject/72605
Search -- https://master.php.net/manage/user-notes.php