jwulff wrote:
How would I calculate if a $number is a multiple of $spacer?
if(int($number / $spacer) == ($number / $spacer)){
echo "It's a multiple!";
}else{
echo "Nope!";
}
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt
to decrypt it will be prosec
Using the modulus operator it returns the remainder of a division operator.
For example to find out if a number is divisible by 3 do this:
if (($number % 3) == 0) {
print $number . ' is divisible by 3';
} else {
print $number . ' is not divisible by 3';
}
If the remainder of dividing the ta
($spacer % $number == 0)
Martin
-Original Message-
From: jwulff [mailto:[EMAIL PROTECTED]
Sent: Thursday, 3 July 2003 11:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Calculating if number is multiple of another number
How would I calculate if a $number is a multiple of $spacer?
--
PHP
How would I calculate if a $number is a multiple of $spacer?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
4 matches
Mail list logo