RE: [PHP] Anyway of knowing whether a integer is odd or even
| From: | Jack Dempsey | Date: | Tue, 09 Oct 2001 14:20:06 +0000 |
| Subject: | RE: [PHP] Anyway of knowing whether a integer is odd or even | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70483@lists.php.net to get a copy of this message | ||
just in case others have this issue, the numeric solution is this:
$num = 10;
if($num % 2 == 0){
echo "number is even";
} else {
echo "number is odd";
}
-----Original Message-----
From: Taylor, Stewart [mailto:Stewart.Taylor@uk.thalesgroup.com]
Sent: Tuesday, October 09, 2001 10:10 AM
To: 'Sam'
Cc: php-general@lists.php.net
Subject: RE: [PHP] Anyway of knowing whether a integer is odd or even
$color = "white";
while ..
{
display row using $color
$color = ($color=="white" ? "grey" : "white");
}
-Stewart
-----Original Message-----
From: Sam [mailto:Sam@dragoman.co.uk]
Sent: 09 October 2001 14:31
To: 'php'
Subject: [PHP] Anyway of knowing whether a integer is odd or even
Hi all,
I have a query which returns X amount of rows.
I would like to display even rows one colour and odd rows a different
colour.
Is there a way to do this?
Thanks in advance,
Sam Rose
p.s. Also I'm only on the digest, so if you could reply directly to me as
well, that would be a bonus.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net