note 48467 added to language.variables
| From: | me at example dot com | Date: | Fri, 24 Dec 2004 20:22:43 +0000 |
| Subject: | note 48467 added to language.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82266@lists.php.net to get a copy of this message | ||
The above poster who suggested that php has a bug because it doesn't let one have a scalar and
an array exist with the same name is on drugs.
In what language can you ever do this? Who, in their right mind would EVER want to have two
different variables with the same name. That's absolutely terrible style. If you must have
the same name for the two variables because you just can't possibly think of a different name
to use, then try how about you name them my_var_scalar and my_var_array.
For future notice, a feature of a language is not a bug just because you don't like it.
It's a bug if it violates the spec of the language. This particular feature is not only not a
bug, it's also very important in a language like PHP that uses type inference.
If you think this is a bug, I chalenge you to write a language that relies on type inference and
allows the programmer to have a different variable with the same name for each type.
Good Luck
----
Manual Page -- http://www.php.net/manual/en/language.variables.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48467
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48467&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48467&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48467&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48467&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48467&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48467&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48467&report=yes
Search -- http://master.php.net/manage/user-notes.php