Re: Foreach list behaviour
| From: | Andrew Faulds | Date: | Mon, 03 Sep 2012 17:36:52 +0000 |
| Subject: | Re: Foreach list behaviour | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62759@lists.php.net to get a copy of this message | ||
On 03/09/12 18:35, Sherif Ramadan wrote:
On Mon, Sep 3, 2012 at 4:20 AM, Derick Rethans <derick@php.net> wrote:-- Andrew Faulds http://ajf.me/Ew, that's quite nasty (in both cases). Is there a way how we could turn those into a notice or so? cheers, DerickSorry, hit reply instead of reply-all... list($a,$b) = 1; var_dump($a,$b); /* NULL NULL */ This doesn't throw notices anywhere else... why should it throw notices in foreach? I guess the only logical answer would be to notify you if you were using scalar values with foreach and list, but then we don't notify you if you're using scalar values with list anywhere else in the language anyway. I'm starting to see huge inconsistencies with how list is being implemented in foreach. Possibly more importantly, since 1 should cast to, er, [1] (I think...), why is $a === NULL?