Smallest and Largest Palindrome with N Digits | Function to print the smallest and largest palindrome with N digits ; Driver Code
< ? php function printPalindrome ( $ n ) { if ( $ n == 1 ) { echo " Smallest ▁ Palindrome : ▁ 0 STRNEWLINE " ; echo " Largest ▁ Palindrome : ▁ 9" ; } else { echo " Smallest ▁ Palindrome : ▁ " , pow ( 10 , $ n - 1 ) + 1 ; echo " Largest Palindrome : " pow ( 10 , $ n ) - 1 ; } } $ n = 4 ; printPalindrome ( $ n ) ; ? >