Re: If value is odd or not

From: Date: Fri, 02 Jun 2006 14:24:12 +0000
Subject: Re: If value is odd or not
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-237274@lists.php.net to get a copy of this message
Steven Osborn wrote:
$odd = array("1","3","5","7","9"); if(inarray(substr($var,strlen($var)-1,1),$od) { //haha } else { //even }
How about this if ($var % 2 == 0) { //it's even } else { //it's odd } -- Online library -- http://pueblonative.110mb.com 126 books and counting.

« previous php.general (#237274) next »