Check whether a given number is even or odd | Returns true if n is even , else odd ; n & 1 is 1 , then odd , else even ; Driver code
< ? php function isEven ( $ n ) { return ( ! ( n & 1 ) ) ; } $ n = 101 ; if ( isEven ( $ n ) == true ) echo " Even " ; else echo " Odd " ; ? >