Re: If value is odd or not

From: Date: Wed, 07 Jun 2006 11:58:12 +0000
Subject: Re: If value is odd or not
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-237550@lists.php.net to get a copy of this message
On 6/5/06, Adam Zey <azey@nit.ca> wrote:
Let's make it even more compact and confusing :) echo "$variable is ".($variable % 2 ?'even':'odd')."<br />\n"; I'm not sure if you can nuke the whitespace in the modulus area or not.
Yes you can,in php whitespaces inside expressions does not have special meaning. echo "$variable is ".($variable%2?'even':'odd')."<br />\n";

« previous php.general (#237550) next »