我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

在php中一组三个分组大数字

I want to chunk large numbers. For example.

//between each three decimals a dot should be placed
33 thousand like this       33.000
33 milion   like this   33.000.000

How can I do this in php?

Use number_format():

number_format(
    $number, 
    0,         //amount of decimal points
    ',',       //decimal seperator
    '.'        //thousands seperator
);

Here is an example:

number_format("33000",0,"",".");
number_format("33000000",0,"",".");

近期文章

  • 什么是正则表达式的解决方案? PHP
  • 如何在php中向表中插入数据?
  • 找到字符串中的最后一个超链接[关闭]
  • CakePHP扩展模型
  • 如何保护管理员文件夹php
  • preg_match_all有特殊字符
  • PDO登录系统无法正常工作
  • 包含在php中的相对路径
  • 解析错误:意外的T_OBJECT_OPERATOR
  • 当我尝试从android发布我的JSON时,Zend $ _POST ['param_name']说“Undefined index”
  • 为什么这个SQL语句不会使用字符串(mm / dd / yy)并将其转换为天?
  • wget cron job不起作用,但是当手动刷新脚本时,它可以工作
  • 我怎么能总是从爆炸中返回最后一系列数字
  • echo可以指定一个浮点数吗?
  • PHP错误“参数未定义”
  • MySQL:搜索特定类型字段中的所有字段
  • PHP,MySQL - 使用join从多个表中删除
  • 无法将数组绑定到CDbCriteria(Yii)
  • 使用正则表达式删除数字分隔符
  • 未插入MySQL表的表单数据[关闭]

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华