PHP scripts and programs for Beginner to Master

php programs, php ready to use scripts & functions, css tutorials, html, javascripts, ajax examples for Beginner to Master

PHP has nice support for Mathematical processing. And for doing rounding off we generally need functions like ceil() and floor().

Lets see how to use these functions...

PHP ceil() Function

The ceil() function rounds the value "UPWARDS" to the nearest integer.

Check the code below


The output of the above code will be 1.

PHP floor() Function

The floor() function rounds off the value "DOWNWARDS" to the nearest integer.
Check the code below

The output of the above code will be 0.