开发者

How i turn like 1592.50 into 1593 with php?

开发者 https://www.devze.com 2022-12-15 08:19 出处:网络
i want a way to check if the number has comma, th开发者_StackOverflow中文版en it return it into the next number.

i want a way to check if the number has comma, th开发者_StackOverflow中文版en it return it into the next number.

example :

<?
    $mynum = "6265.50";
    // output : 6266 , and not 6,266 like the function of number_format()
?>

Thanks


You can use round(); or ceil() to round up fractions.


http://php.net/manual/en/function.ceil.php


You are looking for the ceil function :

$mynum = "6265.50";
echo ceil($mynum);

will give you :

6266


use ceil($mynum)


echo ceil(6265.50);

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号