程序如:
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