Re: [PHP] Ranges for case statement and a WTF moment.

2011-04-07 Thread David Harkness
On Thu, Apr 7, 2011 at 2:16 AM, Richard Quadling wrote: > And all this is shown when you ... > > php -r "print_r(array_map(function(&$token){if(is_array($token)){$token[0] > = token_name($token[0]);} return $token;},token_get_all(' 10...19;')));" > Woah, that's a very nifty trick! I like PHP more

Re: [PHP] Ranges for case statement and a WTF moment.

2011-04-07 Thread Richard Quadling
And all this is shown when you ... php -r "print_r(array_map(function(&$token){if(is_array($token)){$token[0] = token_name($token[0]);} return $token;},token_get_all(' Array ( [0] => T_OPEN_TAG [1] => 1 ) [1] => Array ( [0] => T_ECH

RE: [PHP] Ranges for case statement and a WTF moment.

2011-04-07 Thread Ford, Mike
> -Original Message- > From: David Harkness [mailto:davi...@highgearmedia.com] > Sent: 06 April 2011 21:08 > To: Richard Quadling; PHP General list > Subject: Re: [PHP] Ranges for case statement and a WTF moment. > > On Tue, Apr 5, 2011 at 8:28 AM, Ric

Re: [PHP] Ranges for case statement and a WTF moment.

2011-04-07 Thread Richard Quadling
On 6 April 2011 21:08, David Harkness wrote: > On Tue, Apr 5, 2011 at 8:28 AM, Richard Quadling > wrote: >> >> php -r "var_dump(10...19);" >> >> Interesting output ... >> >> string(6) "100.19" >> >> And that took me a little while to work out. >> >> It's all to do with PHP's type juggling. >> >>

Re: [PHP] Ranges for case statement and a WTF moment.

2011-04-06 Thread David Harkness
On Tue, Apr 5, 2011 at 8:28 AM, Richard Quadling wrote: > php -r "var_dump(10...19);" > > Interesting output ... > > string(6) "100.19" > > And that took me a little while to work out. > > It's all to do with PHP's type juggling. > > 10...19 > > What I'm not sure is why the middle empty string is

[PHP] Ranges for case statement and a WTF moment.

2011-04-05 Thread Richard Quadling
Hi. I just wanted to quickly see if PHP supported ranges in its switch/case statement (http://en.wikipedia.org/wiki/Ellipsis) Completely unexpectedly, the above code runs but produces the wrong output. Interestingly, altering the number of dots and adding spaces all result in parse errors ...