PHP Security Tips : Hiding php In URL (In Hindi)
PHP com port communication In Hindi | Write on com port in PHP
PHP Null Coalescing Operator In Hindi , Null Coalescing Operator kya hai ?
PHP stdClass In Hindi | stdClass In PHP
PHP Interview Questions In Hindi : PHP Interview Preparation
What is DNS In Hindi ? DNS kya hai?
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.
Image on pixabay
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 ! My name is Rahul Kumar Rajput. I'm a back end web developer and founder of learnhindituts.com. I live in Uttar Pradesh (UP), India and I love to talk about programming as well as writing technical tutorials and tips that can help to others.
Get connected with me. :) LinkedIn Twitter Instagram Facebook