Recursive program to check if number is palindrome or not | Recursive function that returns the reverse of digits ; base case ; stores the reverse of a number ; Driver Code
< ? php function rev ( $ n , $ temp ) { if ( $ n == 0 ) return $ temp ; $ temp = ( $ temp * 10 ) + ( $ n % 10 ) ; return rev ( $ n / 10 , $ temp ) ; } $ n = 121 ; $ temp = rev ( $ n , 0 ) ; if ( $ temp != $ n ) echo " yes " ; else echo " no " ; ? >