Maximum OR sum of sub | function to find maximum OR sum ; OR sum of all the elements in both arrays ; Driver Code
< ? php function MaximumSum ( $ a , $ b , $ n ) { $ sum1 = 0 ; $ sum2 = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ sum1 |= $ a [ $ i ] ; $ sum2 |= $ b [ $ i ] ; } echo ( $ sum1 + $ sum2 ) . " STRNEWLINE " ; } $ A = array ( 1 , 2 , 4 , 3 , 2 ) ; $ B = array ( 2 , 3 , 3 , 12 , 1 ) ; $ n = sizeof ( $ A ) / sizeof ( $ A [ 0 ] ) ; MaximumSum ( $ A , $ B , $ n ) ; ? >