To take the ceiling of a number in PHP, you can use the built-in ceil()
function. This function returns the smallest integer greater than or equal to the input number.
Here's an example:
main.php64 chars4 lines
In this example, the variable $num
is assigned the value 3.14
. The ceil()
function is called on $num
, and the result is assigned to the variable $ceiling
. Finally, the value of $ceiling
is echoed to the screen, which in this case is 4
.
gistlibby LogSnag