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

Other Blogs

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 ...

Hey ! I'm Rahul founder of learnhindituts.com. Working in IT industry more than 4.5 years. I love to talk about programming as well as writing technical tutorials and blogs that can help to others .... keep learning :)

Get connected with me - LinkedIn Twitter Instagram Facebook

Your Thought ?

Please wait . . .

    0 Comment(s) found !