RE: [PHP] How can I see if variable is a odd or an even number?
| From: | scott [gts] | Date: | Mon, 16 Jul 2001 16:00:53 +0000 |
| Subject: | RE: [PHP] How can I see if variable is a odd or an even number? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58076@lists.php.net to get a copy of this message | ||
even numbers are even becuase they're divisible by 2
w/o a remainder... use this property to your advantage:
if ( $num % 2 ) {
print "$num is odd";
}
else {
print "$num is even";
}
> -----Original Message-----
> From: SED [mailto:sed@sed.is]
> Sent: Monday, July 16, 2001 12:07 PM
> To: php-general@lists.php.net
> Subject: [PHP] How can I see if variable is a odd or an even number?
>
>
> Do you know if there is a function to find out if a variable contains a
> odd or an even number? I checked the manual but didn't see it.
>
> Thanks!
>
> Regards,
> Sumarlidi Einar Dadason
>
> SED - Graphic Design
>
> ------------------------------------------
> Phone: (+354) 4615501
> Mobile: (+354) 8960376
> Fax: (+354) 4615503
> E-mail: sed@sed.is
> Homepage: www.sed.is
> ------------------------------------------
>
>
> --
> 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
>