Round up float value?

Asked

Viewed 79 times

1

I have a code that calculates the number of pages based on the number of data that is called from the database. But with the code it divides the number of data by 5, ie the maximum number allowed, but the value can come decimal and so it can’t calculate the pages well. Is there any way to round the value of for example 3.2 for 4?

  • Could be the function ceil?

  • 1

    Related: https://answall.com/q/212227/57801

  • 1

    @Everson perfect pointing, I can tell that is dup. (See the Rray was faster than me)

  • @Andersoncarloswoss Put as an answer and I will give as accepted.

1 answer

1


Use:

ceil($number);

If you use:

ceil(3.6);

The result will be 4.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.