what will do ceil() and floor() in PHP?
Answers were Sorted based on User's Feedback
Answer / saurabh rastogi
$var=7.5;
$c_var=ceil($var);
echo $c_var; // Outputs 8
$var=7.5
$c_var=floor($var);
echo $c_var; // Outputs 7
Is This Answer Correct ? | 29 Yes | 2 No |
Answer / nikunj
ceil() func. gives nearest max values of passing value.
floor() func. gives nearest min values of passing value.
see above example
Is This Answer Correct ? | 14 Yes | 2 No |
Answer / paul
ceil() give you the upper number of a fraction.
eg.
ceil(3.0)=3
ceil(3.1)=4
ceil(3.3)=4
ceil(3.5)=4
ceil(3.7)=4
floor() does ceil()'s opposite it returns the lower number
of the fraction
floor(3.0)=3
floor(3.1)=3
floor(3.3)=3
floor(3.5)=3
floor(3.7)=3
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / nilsoft
ceil()
Returns the next highest integer value by rounding up value
if necessary.
<?php
echo ceil(4.3); // 5
echo ceil(9.999); // 10
echo ceil(-3.14); // -3
?>
floor()
Returns the next lowest integer value by rounding down value
if necessary.
<?php
echo floor(4.3); // 4
echo floor(9.999); // 9
echo floor(-3.14); // -4
?>
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / rakesh kumar nautiyal
ceil() return the absolute value of a given var while floor
() return a true value of given variable
Is This Answer Correct ? | 4 Yes | 3 No |
how many type of url?
Hi, My Name is Ajay Jha. What My Question is I am Percuing in Bca. It's My 5th Semester. I Want To Make My Carrear as a web designer that's Why i wants to do Php, Is it right Desision for Me ?
How a constant is defined in a php script?
hi i am complted my b.tech and i want to learn php is php is good for my career and i want to know the salary growth on php any one can tell the answer plz and i am learning php myself it is easy to understand..........
Which functions are used to count the total number of array elements in php?
How to convert a string to uppercase in php?
What is the method to execute a php script from the command line?
how to convert PHP code in to java code
What is array function in javascript?
delete session variable when close browser with out logout
What type of inheritance that PHP supports?
15 Answers Webwing Technologies,
how to hidden querystring url please send sample program