Create an array of size 10 and initialize all elements as false . This array is used to check if a digit is already seen or not .
$ arr = array ( ) ; for ( $ i = 0 ; $ i < 10 ; $ i ++ ) $ arr [ $ i ] = false ;