On Fri, 2008-01-04 at 18:46 +0000, Alain Williams wrote:
> On Fri, Jan 04, 2008 at 01:06:26PM -0500, Robert Cummings wrote:
> > <?php
> > 
> >     echo 'Foo: '.(0 + '5five')."\n";
> >     echo 'Foo: '.((int)'5five')."\n";
> >     echo 'Foo: '.(intval( ' 5five' ))."\n";
> >     echo 'Foo: '.(sprintf( '%d', '5five' ))."\n";
> > 
> > ?>
> > 
> > All produce 5.
> 
> But the string 'foobar' converts to a 0 (zero) -- not what is wanted.

If that's not what's wanted then use the more strict type hint that
generates E_RECOVERABLE. The conversion of 'foobar' to 0 (zero) is what
happens anywhere else when 'foobar' is converted to type int. Why change
that now?

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to