Find the Number Occurring Odd Number of Times | Function to find the element occurring odd number of times ; Driver code ; Function calling
< ? php function getOddOccurrence ( & $ arr , $ arr_size ) { $ count = 0 ; for ( $ i = 0 ; $ i < $ arr_size ; $ i ++ ) { for ( $ j = 0 ; $ j < $ arr_size ; $ j ++ ) { if ( $ arr [ $ i ] == $ arr [ $ j ] ) $ count ++ ; } if ( $ count % 2 != 0 ) return $ arr [ $ i ] ; } return -1 ; } $ arr = array ( 2 , 3 , 5 , 4 , 5 , 2 , 4 , 3 , 5 , 2 , 4 , 4 , 2 ) ; $ n = sizeof ( $ arr ) ; echo ( getOddOccurrence ( $ arr , $ n ) ) ; ? >