note 11484 modified in is_float by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Thu, 22 Feb 2001 19:07:49 +0000 |
| Subject: | note 11484 modified in is_float by jmcastagnetto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11429@lists.php.net to get a copy of this message | ||
[Editor's note: Just a comment, testing using integer modulus would be simpler:
$data3 = ($data1 % 2 == 0) ? "even" : "odd" ;
You could even do:
$data3 = (++$data1 % 2 == 0) ? "even" : "odd" ;
which should do be odd, even, odd, even, ... if $data1 has not been initialized (assumed initial
value of zero) ]
More along the lines of the alternating color scheme for tables...
You can also work out something like this...
some_loop
{
$data1 += $data1;
$data2 = $data1 / 2;
$data3 = is_float($data2) == 1 ? "#000000" : "#222222";
}
http://www.php.net/manual/is-float.php