Re: Scalar type hinting
From: Michael Morris Date: Tue, 28 Feb 2012 23:08:55 +0000 Subject: Re: Scalar type hinting References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Groups: php.internals Request: Send a blank email to [email protected] to get a copy of this message
Agreed. If conversion can occur without data loss (that is, if the value being assigned is == the value that actually IS assigned) then no error should occur. So int $a = "1"; // no error. 1 == "1" so who cares? int $a = 'House'; // error 0 != 'House', so this is a problem. Again, errors should only raise if the final value != source value. On Tue, Feb 28, 2012 at 6:03 PM, Rick WIdmer <[email protected]> wrote: > On 2/28/2012 2:58 PM, Kris Craig wrote: > >> strong int $a = "1"; // Converts to 1. May or may not throw an error (I'm >> still on the fence). > > > It this is an error, it is no longer PHP. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >
Thread (163 messages)
- RE: [PHP-DEV] Scalar type hinting
- Re: Scalar type hinting
- RE: [PHP-DEV] Scalar type hinting
- Re: Scalar type hinting
- RE: [PHP-DEV] Scalar type hinting
- Re: Scalar type hinting
- PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)
- RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)
- RE: [PHP-DEV] Scalar type hinting
- RE: [PHP-DEV] Scalar type hinting
- RE: [PHP-DEV] Scalar type hinting
« previous | php.internals (#58306) | next » |
---|