用PHP将逗号添加到整数 [英] Add comma to a whole number with PHP

查看:59
本文介绍了用PHP将逗号添加到整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用PHP在整数中添加逗号?

How do i add a comma to a whole number with PHP?

示例:$数字= 1000$ output_i_want = 10,00

Example: $number = 1000 $output_i_want = 10,00

示例2:$ number = 10000$ output_i_want = 100,00

Example2: $number = 10000 $output_i_want = 100,00

推荐答案

PHP函数number_format()

PHP算术运算符

number_format( 1000 / 100 , 2, ',', ' ');
number_format( 10000 / 100 , 2, ',', ' ');

这篇关于用PHP将逗号添加到整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆