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

PHP Program for checking Palindrome number

Filed under: PHP on 2022-11-16 13:41:54

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.

About Author:
Vishal Gupta     View Profile
Hi, I am Vishal Gupta. I like this Website for learning MCQs. This website is good for preparation.