Check a number is odd or even without modulus operator | Returns true if n is even , else odd ; Return true if n / 2 does not result in a float value . ; Driver code
< ? php function isEven ( $ n ) { return ( ( int ) ( $ n / 2 ) * 2 == $ n ) ; } $ n = 101 ; if ( isEven ( $ n ) ) echo ( " Even " ) ; else echo ( " Odd " ) ; ? >