note 56753 added to language.variables.scope
| From: | erwinmoller at xs4all dot nl | Date: | Wed, 14 Sep 2005 11:54:06 +0000 |
| Subject: | note 56753 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95160@lists.php.net to get a copy of this message | ||
For those coming from a Java background, beware of the fact that PHP is not aware of variables made
into a block {...}.
PHP will just treat them as if they were declared out the block.
This confused me a little. :-)
example:
<?
if (1==1){
$name = "Zaphod";
}
echo $name;
?>
will just produce Zaphod.
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56753
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56753&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56753&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56753&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56753&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56753&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56753&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56753&report=yes
Search -- http://master.php.net/manage/user-notes.php