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:[EMAIL PROTECTED]]
> Sent: Monday, July 16, 2001 12:07 PM
> To: [EMAIL PROTECTED]
> 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:      [EMAIL PROTECTED]
> Homepage:    www.sed.is
> ------------------------------------------
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to