Re: If value is odd or not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonas Rosling wrote:
Hi all,
is there any easy why to check if a value is odd or not?

the modulos operator:

read about what it does here:
http://php.net/manual/en/language.operators.arithmetic.php

here is a simple example of how to check if something
is odd or not (odd number that is ;-):

$x = 1;
$y = 2;
$z = 3;

var_dump(($x % 2), ($y % 2), ($z % 2));


Thanks // Jonas


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux