Re: Thousands Separator
| From: | Jeffry Killen | Date: | Fri, 16 Jan 2015 22:31:54 +0000 |
| Subject: | Re: Thousands Separator | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324261@lists.php.net to get a copy of this message | ||
Here is some more that you may find useful:
In your hypothetical example:
$num = '123_456_789',
$num is a string.
and I presume you mean that this is hard coded into your source file
code and you want to be able to read the source code with greater ease.
So you can hard code it this way and if you want to use the value as an
actual number in some mathmatical processing:
$num = settype(str_replace('_', '', '123_456_789'), 'int');
or--
$num = '123_456_789';
function use($num)
{
return settype(str_replace('_', '', $num), 'int')
}
$num = use($num);
Or settype( string, 'float') if there is a decimal fraction involved.
On Jan 16, 2015, at 10:49 AM, Jennifer wrote:
$num = '123_456_789',