if I have a variable $check20Multi
and I want to check if $check20Multi falls in the multiple of 20, that is, check if it is 20, 40, 60, 80 .... 2000
how can I do it....
because I want to do the following:
if $check20Multi is equal to A Multiple of 20
then $totalpage = $totalpage + 1;
math
Moderator: General Moderators
- trollll
- Forum Contributor
- Posts: 181
- Joined: Tue Jun 10, 2003 11:56 pm
- Location: Round Rock, TX
- Contact:
You want the modulus
if ($check20Multi%20==0) {
$totalpage = $totalpage + 1;
}
//
if $check20Multi = 42, then $check20Multi%20 = 2
"%" gives you the remainder of $check20Multi/42
check out the arithmetic operators:
http://www.php.net/manual/en/language.o ... hmetic.php
$totalpage = $totalpage + 1;
}
//
if $check20Multi = 42, then $check20Multi%20 = 2
"%" gives you the remainder of $check20Multi/42
check out the arithmetic operators:
http://www.php.net/manual/en/language.o ... hmetic.php