Re: Re: Thousands Separator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/16/2015 11:16 AM, Christoph Becker wrote:
> Jennifer wrote:
> 
>> 	I hate to ask what seems to be a simple question but, does PHP have a thousands separator for large numbers in constants or variables?  In Perl, you can use the underscore, e.g. $num = '123_456_789', but that doesn't work in PHP.  
>>
>> 	I can't find an answer anywhere, so I hope the answer isn't "no".  :\
> 
> Unfortunately, it is, see
> <http://php.net/manual/en/language.types.integer.php> resp.
> <http://php.net/manual/en/language.types.float.php>.
> 
> I can think of the following workaround for variable and defined
> constant values
> 
>   number('123_456_789')
> 
> where
> 
>   function number($num)
>   {
>       return str_replace('_', '', $num);
>   }
> 
> Perhaps it makes sense to file a feature request to extend the syntax of
> number literals on <https://bugs.php.net/>.
> 

What would be the point of this?

-- 
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux