PHP Program to check whether number is Palindrome or not | PHP Find Palindrome Number

Blogs ❯❯ PHP

Image could not load

Image on pixabay

What is palindromic number ?

palindromic number वो numbers होते हैं जिनके digits reverse करने पर meaning / value same ही रहती है। example के लिए 2002 इसे reverse करने पर भी इसकी value same ही रहेगी। इसी तरह से 1221 और बाकी कुछ numbers भी होते हैं।

इस article में PHP में हम Palindrome number check करने के लिए function की help से program बनाएंगे , जिसमे एक number pass करने पर हमें boolean value मिलेगी। अगर pass किया गया number , Palindrome है तो true otherwise false return होगा।

PHP program to check palindrome number

<?php /* * Function to check for Palindrome Number. * @param $number (Number) */ function isPalindrome($number) { $temp = $number; $new = 0; while (floor($temp)) { $d = $temp % 10; $new = $new * 10 + $d; $temp = $temp/10; } if ($new == $number) return 1; else return 0; } // take any random number. $number = 1001; if (isPalindrome($number)) echo "{$number} is palindrome number."; else echo "{$number} is not palindrome number."; ?>

Output :

1001 is palindrome number. 
Recent Blogs

Loading ...

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook