Insertion Sort in PHP With Example | How Does Insertion Sort Work in PHP
PHP Interview Questions In Hindi : PHP Interview Preparation
PHP object Type Casting In Hindi | PHP object In Hindi
PHP com port communication In Hindi | Write on com port in PHP
JavaScript Spread syntax In Hindi : Spread Operator In JavaScript
Logical Operators In JavaScript In Hindi | JS Logical Operators In Hindi
Laravel Service Container Example | Service Container In Laravel In HIndi
प्रसिद्ध मुहावरे और कहावतें हिंदी में | Famous Muhaware In Hindi | Hindi Muhaware Part 1
If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
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
/*
* 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.
Loading ...
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. 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