Count pairs with Bitwise OR as Even number | PHP program to count pairs with even OR ; Count total even numbers in array . ; return count of even pair ; Driver Code
< ? php function findEvenPair ( & $ A , $ N ) { $ count = 0 ; for ( $ i = 0 ; $ i < $ N ; $ i ++ ) if ( ! ( $ A [ $ i ] & 1 ) ) $ count ++ ; return $ count * ( $ count - 1 ) / 2 ; } $ A = array ( 5 , 6 , 2 , 8 ) ; $ N = sizeof ( $ A ) ; echo findEvenPair ( $ A , $ N ) . " STRNEWLINE " ; ? >