You are here: Home / Topics / PHP Program for checking Palindrome number

PHP Program for checking Palindrome number

By Vishal Gupta on 16 Nov 22 | Filed under: PHP

The below program checks for a Palindrome number using a loop. The PHP echo statement is used to output the result on the screen. A number is called as a Palindrome number if the number remains same even when its digits are reversed.

Palindrome Number:

abcde = edcba

Example: 24142, 1234321, etc.

<!DOCTYPE html>


$num = 123454321;  
$x = 0;
$n =$num;

$mod = $num%10;
$x = $x * 10 + $mod;  
$num = $num/10;

echo "$n is a Palindrome number.";  

echo "$n is not a Palindrome number.";  



123454321 is a Palindrome number.

Login or register to add Comments.