note 105925 added to language.variables.scope
| From: | dodothedreamer at gmail dot com | Date: | Mon, 26 Sep 2011 06:56:23 +0000 |
| Subject: | note 105925 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183427@lists.php.net to get a copy of this message | ||
Note that unlike Java and C++, variables declared inside blocks such as loops or if's, will
also be recognized and accessible outside of the block, so:
<?php
for($j=0; $j<3; $j++)
{
if($j == 1)
$a = 4;
}
echo $a;
?>
Would print 4.
----
Server IP: 69.147.83.197
Probable Submitter: 67.185.88.116
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- https://master.php.net/note/edit/105925
Del: integrated -- https://master.php.net/note/delete/105925/integrated
Del: useless -- https://master.php.net/note/delete/105925/useless
Del: bad code -- https://master.php.net/note/delete/105925/bad+code
Del: spam -- https://master.php.net/note/delete/105925/spam
Del: non-english -- https://master.php.net/note/delete/105925/non-english
Del: in docs -- https://master.php.net/note/delete/105925/in+docs
Del: other reasons-- https://master.php.net/note/delete/105925
Reject -- https://master.php.net/note/reject/105925
Search -- https://master.php.net/manage/user-notes.php