Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Andrew Faulds
On 03/09/12 18:46, Sherif Ramadan wrote: 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

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Sherif Ramadan
On Mon, Sep 3, 2012 at 1:36 PM, Andrew Faulds wrote: > On 03/09/12 18:35, Sherif Ramadan wrote: >> >> On Mon, Sep 3, 2012 at 4:20 AM, Derick Rethans 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 >>

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Andrew Faulds
On 03/09/12 18:35, Sherif Ramadan wrote: On Mon, Sep 3, 2012 at 4:20 AM, Derick Rethans 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); /* NUL

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Sherif Ramadan
On Mon, Sep 3, 2012 at 4:20 AM, Derick Rethans 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 no

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Andrew Faulds
Laruence wrote: >Hi: > if we fixed this, what about following example: > > >$num = NULL; > >echo $num["xxx"]; > > > does this also deserve a notice? > >thanks No because NULL is just the first element in implicit array conversion > > > >-- >Laruence Xinchen Hui >http://www.laruence.com/

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Laruence
On Mon, Sep 3, 2012 at 5:28 PM, Pierre Joye wrote: > hi, > > On Mon, Sep 3, 2012 at 10:36 AM, Laruence wrote: >> On Mon, Sep 3, 2012 at 4:20 PM, Derick Rethans wrote: >>> On Mon, 3 Sep 2012, Laruence wrote: >>> On Mon, Sep 3, 2012 at 7:07 AM, Jared Williams wrote: > >

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Pierre Joye
hi, On Mon, Sep 3, 2012 at 10:36 AM, Laruence wrote: > On Mon, Sep 3, 2012 at 4:20 PM, Derick Rethans wrote: >> On Mon, 3 Sep 2012, Laruence wrote: >> >>> On Mon, Sep 3, 2012 at 7:07 AM, Jared Williams >>> wrote: >>> > >>> > Just looking at the foreach list behaviour and it does this..

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Laruence
On Mon, Sep 3, 2012 at 4:20 PM, Derick Rethans wrote: > On Mon, 3 Sep 2012, Laruence wrote: > >> On Mon, Sep 3, 2012 at 7:07 AM, Jared Williams >> wrote: >> > >> > Just looking at the foreach list behaviour and it does this... >> > >> > $i = [1, 2, 3]; >> > foreach($i as list($a, $b)) >>

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Derick Rethans
On Mon, 3 Sep 2012, Laruence wrote: > On Mon, Sep 3, 2012 at 7:07 AM, Jared Williams > wrote: > > > > Just looking at the foreach list behaviour and it does this... > > > > $i = [1, 2, 3]; > > foreach($i as list($a, $b)) > > var_dump($a, $b); > > > > Outputs > > > > NULL > >

Re: [PHP-DEV] Foreach list behaviour

2012-09-02 Thread Laruence
Hi: this is expected behavior, like: wrote: > Hi, > > Just looking at the foreach list behaviour and it does this... > > $i = [1, 2, 3]; > foreach($i as list($a, $b)) > var_dump($a, $b); > > Outputs > > NULL > NULL > NULL > NULL > NULL > NULL > > There is no test I can see