Re: type hinting

From: Date: Fri, 04 Jan 2008 18:46:03 +0000
Subject: Re: type hinting
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-34446@lists.php.net to get a copy of this message
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. -- Alain Williams Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php Chairman of UKUUG: http://www.ukuug.org/ #include <std_disclaimer.h>

« previous php.internals (#34446) next »