On Mon, Sep 3, 2012 at 1:36 PM, Andrew Faulds <a...@ajf.me> wrote: > On 03/09/12 18:35, Sherif Ramadan wrote: >> >> On Mon, Sep 3, 2012 at 4:20 AM, Derick Rethans <der...@php.net> wrote: >>> >>> Ew, that's quite nasty (in both cases). Is there a way how we could turn >>> those into a notice or so? >>> >>> cheers, >>> Derick >>> >> Sorry, 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? > > -- > Andrew Faulds > http://ajf.me/ >
It should absolute not cast anything. list($a, $b) = $c; is the equivalent of saying $a = $c[0]; $b = $c[1]; In this case $c just happens to be a scalar value and as such you can not derive anything from the scalar value in that context. It is implicitly null. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php