tags:

views:

84

answers:

5

Hi all,

i want a way to check if the number has comma, then it return it into the next number.

example :

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

Thanks

+3  A: 

use ceil($mynum)

Hubert Perron
+8  A: 

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

Jonathan Sampson
Thanks jonathan !
David
It's worth noting that the default behavior of `round()` is to round up. Rounding can be modified, however, by changing the third parameter to one of `PHP_ROUND_HALF_UP`, `PHP_ROUND_HALF_DOWN`, `PHP_ROUND_HALF_EVEN`, or `PHP_ROUND_HALF_ODD`.
cballou
+3  A: 

echo ceil(6265.50);

Erik
+3  A: 

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

slayerIQ
+4  A: 

You are looking for the ceil function :

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

will give you :

6266
Pascal MARTIN