$i = 10; if ( $i&1 ) { echo "$i is odd"; } else { echo "$i is even"; } How to find out whether a number is odd or even using PHP