tags:

views:

42

answers:

2

$number = some number;

When I divide this number, it gives not a round value.

Can give something like 3.13.

How to round it to the biggest value?

Like:

if ($number == 3.5) {
    $number = 4;
} elseif ($number = 3.51) {
   $number = 4;
} else if ($number == 3.49) {
   $number = 3;
}
+1  A: 

What about round

JonH
he/she is explicitly searching for ceil, not round
Joe Hopfgartner
+3  A: 

Just use the built in function round(). You can specify precision(how many decimal points you want) by using the function like so round($float,$precision).

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

Robert
he/she is explicitly searching for ceil, not round
Joe Hopfgartner
+1 to compensate for the -1 (Since your answer does exactly what the example provided intends)... @Joe: But read the example. If it's `3.49`, the expectation is `3`... So `round()` does fit the code provided (granted, the text of the question is ambiguous at best, so I can see the point of contention)...
ircmaxell
correct... didnt see that :P haha, well removing my vote and answer. "lord let it rain manpages"
Joe Hopfgartner