Search This Blog

Showing posts with label if. Show all posts
Showing posts with label if. Show all posts

if-else-if statement or if else if statement in php

<?php

$sno=101;
$name='hari kishore';
$marks=300;

if($sno==101)
  {
     if($name=='hari kishore')
        {
           if($marks>=300)
               {
                  echo 'you are second class';

                }
             else
                {
                    echo 'you are not second class';
                 }
         }
       else 
         {
               echo 'you are not hari kishore';
          }
    }

?>

output : you are second class

if-else statement in php

<?php

$num=21;

if($num==20)
  {
     echo 'number is 20';
   }

else
   {
     echo 'number is not 20';
   }

?>

output : number is not 20

if statement or single if statement in php

<?php

$num=21;

if($num==21)
   {
      echo 'number is 21<br>';
    }


if($num==20)
   {
       echo 'numbet is 20<br>';
    }
?>


output : number is 21

Share Links

Related Posts Plugin for WordPress, Blogger...