[英]Converting a string number with Dotted Separator in PHP
I have a variable 我有一个变量
<?php $number = "10000000"; ?>
I want convert a string to string number with dotted seperator like this: 10000000 -> 10.000.000 我想用一个虚线分隔符将字符串转换为字符串数字,如下所示:10000000 - > 10.000.000
What can i do now? 我现在能做什么? Thanks. 谢谢。
The number_format()
function formats a number with grouped thousands. number_format()
函数格式化一个数字为千位的数字。 For the dotted separator simply use '.'
对于虚线分隔符,只需使用'.'
as the fourth argument: 作为第四个论点:
echo number_format("10000000", 0, ",", "."); //10.000.000
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.