check if the digit is greater than the previous one If true , then break from the loop as we are in descending order part
if ( $ prev < $ n % 10 ) { $ flag = false ; break ; } $ prev = $ n % 10 ; $ n = ( int ) $ n / 10 ; } } return $ flag ; }