Re: pair numbers

From: Date: Tue, 13 Aug 2002 15:27:26 +0000
Subject: Re: pair numbers
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-86772@lists.php.net to get a copy of this message
> i,m new in this confference I think your looking for php-general@lists.php.net > can u help me with small problem? i,m looking 4 function which checking > pair int. number true/false (1=false, 2=true, 3=flase, 4=true, etc.) Seen as this is a quick one ... I think your looking to see if a number is odd or even... for this you will probably want to check the modulus from 2. EG: if ($var % 2) { echo "Odd!"; } else { echo "Even!"; } or a more compact version ... echo ($var%2) ? "Odd!" : "Even!"; -- Dan Hardiker [dhardiker@staff.firstcreative.net] ADAM Software & Systems Engineer First Creative Ltd

« previous php.dev (#86772) next »