Code driven
$ x = 20 ; $ arr = array ( 10 , 30 , 20 , 50 , 20 ) ; $ n = sizeof ( $ arr ) / sizeof ( $ arr [ 0 ] ) ; echo findFirst ( $ arr , $ n , $ x ) ; #This  code is contributed by Tushil. NEW_LINE ? >