Hello,
is there a function that tells me if a variable (number) is an even number or an odd number?
there must be.. but i can't find it.
thanks
Mike
Well, you can use the modulo operator, as in
if ($num % 2 == 0) //$num is even else //$num is odd
hi,
Not sure wether it exists. But easy to write?
function is_even($number) { if (is_int($number/2)) { $even ="TRUE"; } else { $even = "FALSE"; } return $even; } echo is_even(4);
thanks.. i got it figured and working...