php函数 千分位,php函数number_format将数值三位分割,加千分位的分隔符,首字母...

程序如:

number_format.php :

view plaincopy to clipboardprint?

1.<?php

2.$number = 1234.56;

3.$english_format_number = number_format($number);

4.echo $english_format_number;

5.?>

1.php number_format.php

2.,235

要把SQL查询出来的数值以下面的方法显示

1122222.21 显示为1,122,222.21

用number_format函数这么写啊?!

各位最好给个代码,谢谢

$number=1122222.21;

echo number_format($number, 2, ".", ",");

我需要:

view plaincopy to clipboardprint?

1.<?php

2. //$num = 12345678.9;

3. $num = 12345678;

4. echo number_format($num, 0, "", ",");

5.?>

$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

首个字母大写:

view plaincopy to clipboardprint?

1.<?php

2.$name ="jackxiang";

3.echo ucfirst($name);

4.?>

执行后,如下:

1.root@116.255.139.240:/home/admin/php# php ucfirst.php

2.Jackxiang

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值