Begin forwarded message:

> From: Andrea Faulds <a...@ajf.me>
> Subject: Re: PHP RFC: Scalar type-hinting with cast
> Date: 11 August 2014 13:46:05 BST
> To: Benjamin Morel <benjamin.mo...@gmail.com>
> 
> 
> On 11 Aug 2014, at 13:41, Benjamin Morel <benjamin.mo...@gmail.com> wrote:
> 
>> Hi,
>> 
>> I’m a strong supporter of this feature request, so first of all thank you 
>> for taking over the RFC!
>> 
>> I noticed that there is a use-case that is not present in the RFC and should 
>> IMO be explicitly documented: the strings of digits with leading zeros.
>> 
>> I think these should “pass” when type-hinted as int:
>> “0123” => 123
>> “-0123” => -123
>> 
>> Note that the conversion should be done in base 10, not 8 (octal) as this is 
>> what the explicit (int) type-casting does:
>> echo 0123; // 83
>> echo (int) “0123”; // 123
>> 
>> I hope you can add this to the RFC.
> 
> The patch as it stands does support this, and they are base 10. PHP doesn’t 
> consistently deal with bases the same as it stands, however. I’d like to fix 
> that at some point.
> 
> Also, the RFC is effectively dead at this point. I will retire it once I have 
> a better replacement.
> 
> --
> Andrea Faulds
> http://ajf.me/

--
Andrea Faulds
http://ajf.me/





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

Reply via email to