Conditional Rendering in React Complete Guide with Examples 2026

Image
  Conditional Rendering in React Conditional Rendering is one of the most useful concepts in React. It means showing different content on the screen depending on a condition. For example: If a user is logged in → show Logout If a user is not logged in → show Login If a student has passed → show Congratulations If a product is available → show Buy Now If data is loading → show Loading... React does not have a separate if rendering tag. Instead, we use normal JavaScript conditions such as if, the ternary operator, &&, and switch to decide what should appear in the UI.

PHP program palindrome number

 palindrome number in php

 

palindrome number in php

palindrome number  ::-

1] palindrome number is a number which remains same digits reversed.

2] eg ::- number - 24142 is a palindrome number. 

 on reversing same digits .


1) take a number .

 2) Reverse the input digits.

3) compare the two digits.

4) If equal it is digits is palindrome. 


 palindrome number in php

Example ::-

<?php
function palindrome($n){
    $number =$n;
    $sum = 0;
    while(floor($number))
    {
        $rem = $number % 10;
        $sum = $sum * 10+$rem;
        $number = $number/10;

    }
  return $sum;
}
$input= 1235321;
$num= palindrome($input);
if($input==$num){
echo "$input is a palindrome number";
}
else {
    echo "$input is not a palindrome";
   
}


?>

 palindrome number in php 

Output ::- 

·        Palindrome Number use in  form in php

Example :-

<form method="post">
    Enter a number
    <input text="text" name="number">
    <br></br>
    <button type="submit">Check number</button>
</form>
<?php
if($_POST)
{
    $number=$_POST['number'];
    $reverse=strrev($number);
    if($number==$reverse){
        echo"The number  $number is polindrome";
    }
    else{
        echo"The number $number is not a
polindrom";

    }
    }
?>

   Output :-



 Recommended Articles 

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example