Find the element that appears once in an array where every other element appears twice | Return the maximum Sum of difference between consecutive elements . ; Do XOR of all elements and return ; Driver code
< ? php function findSingle ( $ ar , $ ar_size ) { $ res = $ ar [ 0 ] ; for ( $ i = 1 ; $ i < $ ar_size ; $ i ++ ) $ res = $ res ^ $ ar [ $ i ] ; return $ res ; } $ ar = array ( 2 , 3 , 5 , 4 , 5 , 3 , 4 ) ; $ n = count ( $ ar ) ; echo " Element ▁ occurring ▁ once ▁ is ▁ " , findSingle ( $ ar , $ n ) ; ? >