To eliftymes below:
To check if a numer is divisible by another number just check if the modulus is zero:
if ($bigger_number % $lower_number == 0)
{
echo "Can be wholey divided<br />";
}
else
{
echo "Not wholey divisible";
}
![]() | ceil说明float ceil ( float value )返回不小于 value 的下一个整数,value 如果有小数部分则进一位。ceil() 返回的类型仍然是 float,因为 float 值的范围通常比 integer 要大。
![]()
rjones at i-ps dot net
05-Mar-2006 08:19
To eliftymes below:
tom pittlik
28-Feb-2006 08:02
ceil() is a useful way to quickly format bogus shopping cart quantities:
eliftymes at gmail dot com
24-Feb-2006 04:20
Here's a little function I wrote that checks if a number is divisible by another number.
ermolaeva_elena at mail dot ru
20-Dec-2005 11:27
To round a number up to the nearest power of 10,
nobody
23-Nov-2005 01:00
Here's a more simple one to do ceil to nearest 10:
schmad at miller dash group dot net
19-Apr-2005 12:38
To round a number up to the nearest power of 10 use this simple procedure:
coxswain at navaldomination dot com
17-Mar-2005 06:06
steve_phpnet // nanovox \\ com wouldn't:
steve_phpnet // nanovox \\ com
01-Mar-2005 04:40
I couldn't find any functions to do what ceiling does while still leaving I specified number of decimal places, so I wrote a couple functions myself. round_up is like ceil but allows you to specify a number of decimal places. round_out does the same, but rounds away from zero.
sven at plus dot hr
10-Feb-2005 07:59
function roundaway($num) {
aaron at mind-design dot co dot uk
22-Jul-2004 04:10
Or for the terniary fans:
rainfalling at yahoo dot com
22-Apr-2004 08:51
IceKarma said: "If you want, say, 2.6 to round to 3, and -2.6 to round to -3, you want round(), which rounds away from zero."
roger_dupere at hotmail dot com
10-Nov-2003 06:02
Here is a navbar using the ceil function.
zomis2k at hotmail dot com
23-May-2003 02:24
>If you want, say, 2.6 to round to 3, and -2.6 to round to -3, you want round(), which rounds away from zero.
IceKarma
22-Apr-2003 08:31
ceil() rounds towards positive infinity ("up"), floor() rounds towards negative infinity ("down").
clx at deim dot net
12-Jun-2002 04:55
<?php
| ![]() | |