Is number odd or even?
Testing whether a number is odd or even in PHP. The custom function is_odd() below is inspired by an algorithms thread at Devshed. The function isn’t even necessary and could be expressed as a one-liner like this:
echo($number & 1); // $number = any integer, 0 = even, 1 = odd
Here’s the code to check […]
