逗号后删除小数

时间:2017-05-23 08:22:03

标签: php

我想删除逗号后的所有数字,或用逗号.替换,点 我做了这些功能,但不起作用:

public static function millionFormat($number){
    $newNumber=round(($number/1000000),0).' billion'; //;   round(($n/1000000000),1).' billion';
    $newNumber= number_format($newNumber,2,'.','');
    return $newNumber;
    }

public static function kiloFormat($number){
    $newNumber=round_up(($number/1000),0).' billion';
    $newNumber= number_format($newNumber,2,'.','');
    return $newNumber;
    }
}

我怎么做? 谢谢。

1 个答案:

答案 0 :(得分:0)

string number_format ( float $number , int $decimals = 0 , string $dec_point = "." , string $thousands_sep = "," )

所以:

$newnumber = number_format(round(($number/1000000),0), 0, "", " ") . " billion";