Re: [RFC] Number Format Separator

From: Date: Wed, 30 Dec 2015 23:13:47 +0000
Subject: Re: [RFC] Number Format Separator
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-89931@lists.php.net to get a copy of this message
On Wed, Dec 30, 2015 at 11:00:55PM +0000, Davey Shafik wrote: > You mention no support for numeric strings, but how will settype($string, > int|float), intval(), floatval(), is_numeric() and ctype_digit() work with > this change? > > I do think if you don't change the semantics for strings to number > conversion (which I agree you can't due to BC breaks) there should be an > explicit way to support "1_000_000" => (int) 1_000_000. This should be part > of the RFC. > > I presume that if you were to go from numeric to string the underscores > would be stripped? What about a way not to do that? What will var_dump() > etc. show? I think that he is just talking about numeric constants in programs; he is not talking about run time strings (eg read from a file/form) being allowed to contain '_'. Perl does exactly what Thomas is proposing, it does improve readability. There is not a BC problem since today something like 1_000 is illegal as a constant in a program. I think that it is a good idea. -- Alain Williams Linux/GNU 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 #include <std_disclaimer.h>

« previous php.internals (#89931) next »