Re: Implicit Arrays and E_STRICT
| From: | Sara Golemon | Date: | Sat, 08 May 2004 16:42:50 +0000 |
| Subject: | Re: Implicit Arrays and E_STRICT | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9737@lists.php.net to get a copy of this message | ||
> I don't think any error message should be thrown during implicit array
> creation. Not having to define your variables is one of the main
principles
> of the PHP language. I definitely don't think this should be changed. I
> also don't see how this differs very much from a regular assignment to an
> undefined variable (e.g. $var = 2; ).
>
It differs in that if $var is already defined, doing $var = 2; COMPLETELY
overwrites it. However if $array is already defined, then $array[] ADDS to
it. I see implicit array creation as "bad" in the same way that
register_globals is "bad".
That is to say, it's not inherently evil, just prone to unexpected behavior
when not used correctly.
> I think making this an error, even an E_STRICT is a very bad move.
>
Then we differ on that. Because I think it would be a useful tool for
helping the conscientious scripter avoid little, but potentially harmful
mistakes.
-Sara