Check whether bitwise OR of N numbers is Even or Odd | Function to check if bitwise OR of n numbers is even or odd ; if at least one odd number is found , then the bitwise OR of all numbers will be odd ; Bitwise OR is an odd number ; Driver Code
< ? php function check ( $ arr , $ n ) { for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { if ( $ arr [ $ i ] & 1 ) return true ; } return false ; } $ arr = array ( 3 , 9 , 12 , 13 , 15 ) ; $ n = sizeof ( $ arr ) / sizeof ( $ arr [ 0 ] ) ; if ( check ( $ arr , $ n ) ) echo " Odd ▁ Bit - wise ▁ OR " ; else echo " Even ▁ Bit - wise ▁ OR " ; ? >