程序如:
number_format.php :
用正则的方法进行分割:
---------- 调试PHP ----------
1,234.56
输出完成 (耗时 0 秒) - 正常终止
要把SQL查询出来的数值以下面的方法显示
1122222.21 显示为1,122,222.21
用number_format函数这么写啊?!
各位最好给个代码,谢谢
$number=1122222.21;
echo number_format($number, 2, ".", ",");
我需要:
$result=array("day_key"=>$rs->fields['day_key'],"week"=>$rs->fields['week'],"pv"=>number_format($rs->fields['pv'], 0, "", ","),"uip"=>number_format($rs->fields['uip'], 0, "", ","),"reg_member"=>number_format($rs->fields['reg_member'], 0, "", ","),"upload_ct"=>number_format($rs->fields['upload_ct'], 0, "", ","),"play_ct"=>number_format($rs->fields['play_ct'], 0, "", ","),"video_total"=>number_format($rs->fields['video_total'], 0, "", ","),"play_time"=>number_format($rs->fields['play_time'], 0, "", ","));
参考:http://www.phpe.net/manual/function.number-format.php
首个字母大写:
执行后,如下:
再参考:http://www.jb51.net/article/30478.htm
number_format.php :
用正则的方法进行分割:
---------- 调试PHP ----------
1,234.56
输出完成 (耗时 0 秒) - 正常终止
要把SQL查询出来的数值以下面的方法显示
1122222.21 显示为1,122,222.21
用number_format函数这么写啊?!
各位最好给个代码,谢谢
$number=1122222.21;
echo number_format($number, 2, ".", ",");
我需要:
$result=array("day_key"=>$rs->fields['day_key'],"week"=>$rs->fields['week'],"pv"=>number_format($rs->fields['pv'], 0, "", ","),"uip"=>number_format($rs->fields['uip'], 0, "", ","),"reg_member"=>number_format($rs->fields['reg_member'], 0, "", ","),"upload_ct"=>number_format($rs->fields['upload_ct'], 0, "", ","),"play_ct"=>number_format($rs->fields['play_ct'], 0, "", ","),"video_total"=>number_format($rs->fields['video_total'], 0, "", ","),"play_time"=>number_format($rs->fields['play_time'], 0, "", ","));
参考:http://www.phpe.net/manual/function.number-format.php
首个字母大写:
执行后,如下:
再参考:http://www.jb51.net/article/30478.htm
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/1123/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2014-1-26 15:29
评论列表