PHP ceil

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : ceil() function

Description

The ceil() function is used to get the next highest integer value by rounding up.

Version

(PHP 4 and above)

Syntax

ceil (num_value)

Parameter

Name

Description

Required /
Optional

Type

num_value

The value to round.

Required

Float

Return value

Rounded up to the next highest integer of num_value.

Value Type : Float.

Pictorial Presentation

php-math-abc()

Example :

  

  

  1.  

  2.  

  3. $ceil1=ceil(9.4);  

  4. $ceil2=ceil(29.449);  

  5. $ceil3=ceil(-8.4);  

  6. $ceil4=ceil(801.9);  

  7. $ceil5=ceil(1200.94);  

  8. echo "Result of ceil(9.4) is : ". $ceil1 . "
    " ;  

  9. echo "Result of ceil(29.449) is : ". $ceil2 . "
    " ;  

  10. echo "Result of ceil(-8.4) is : ". $ceil3 . "
    " ;  

  11. echo "Result of ceil(801.9) is : ". $ceil4 . "
    " ;  

  12. echo "Result of ceil(1200.94) is : ". $ceil5 . "
    ";  

  13. ?>  

  14.   

  15.    

Output :

Result of ceil(9.4) is : 10
Result of ceil(29.449) is : 30
Result of ceil(-8.4) is : -8
Result of ceil(801.9) is : 802
Result of ceil(1200.94) is : 1201