Testing odd or even numbers with modulo or php bitwise operators:
1. The fastest function, using php binary AND operator (Bitwise)
<?php
function is_odd( $int ) {
return( $int & 1 );
}
?>
2. and the alternative using php modulo operator (Arithmetic)
<?php
function is_odd($number) {
return $number%2;
}
?>
** NOTE ** script using bitwise operations more efficiently than modulo !!!
[ Short URL ... ]



