Bug #1269 Updated: is_array function defines the variable?
| From: | Bug Database | Date: | Fri, 26 Mar 1999 17:17:15 +0000 |
| Subject: | Bug #1269 Updated: is_array function defines the variable? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-4780@lists.php.net to get a copy of this message | ||
ID: 1269
Updated by: zeev
Reported By: arneodo@initiative.fr
Status: Closed
Bug Type: Misbehaving function
Assigned To:
Comments:
is_array() doesn't create the variable, it is created before
the call to is_array(), and passed to it. You need to understand
how PHP's automatic declaration of variables work.
In essence:
As soon as you reference a variable, it is automatically defined.
For example, if you pass a variable to is_array(), like you have
in your example, PHP checks out whether it exists, if it doesn't -
it creates it, and then it passes it over to is_array(). It has
to pass *something*, that's why the variable is automatically defined.
The implementation of is_array() has nothing to do with this
behavior - each and every function in PHP would behave in the same
way.
There aren't too many exceptions to this case, basically, only
three special functions may reference a variable without causing
it to be implicitly declared - those are unset(), isset() and empty().
Full Bug description available at: http://ca.php.net/bugs.php3?id=1269
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net