php - Is zero (0) an even or odd number? -
not request code of type.
let's randomly generating number between 0 , ten , doing until receive number. 0 available result?
are evens 0-10:
2, 4, 6, 8, 10
-or-
0, 2, 4, 6, 8, 10
mathematically, 0 even. php has no built-in notion of even.
a (mathematically correct) test parity checking if number vanishes mod 2. test implemented $number % 2 == 0
. 0 can check 0 mod 2 0, , considered even.
Comments
Post a Comment