php 金额每三位添加一个逗号

function feeHandle($fee){
if (is_numeric($fee)) {
list($int, $decimal) = explode('.', $fee);
$int = preg_replace('/(?<=[0-9])(?=(?:[0-9]{3})+(?![0-9]))/', ',',$int);
if ($decimal)$int .= '.'. $decimal;
return $int;
}
}
posted @ 2018-11-30 15:13  爱冯果  阅读(1689)  评论(1编辑  收藏  举报