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 target by the number is 0 then it is a multiple of the number.

jwulff wrote:

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



Reply via email to