Reputation: 21406
I know about php's built in round()
function, which return 2
for 1.6
. But it return 1
for 1.1
. I want to return the next number if the given number has a fractional part. For example, I want to return 2
for 1.1
, or 1.01
, or even 1.0001
. But I don't want to return the same for 1.0
, which may return 1
itself. How can I achieve this in PHP?
Upvotes: 0
Views: 202
Reputation: 6888
Use ceil()
to round up to the next number
echo ceil(1.0); // will echo 1
http://www.php.net/manual/en/function.ceil.php
Upvotes: 1