converting the sub - str$ing starting from index ' i ' and having length ' len ' to int and checking if it is greater than X or not
$ num = intval ( substr ( $ S , $ i , $ len ) ) ; if ( $ num > $ X ) $ cnt ++ ; } } } return $ cnt ; }