Site icon DataFlair

PHP Conditional Statements Part – 1

Program 1

<html>
    <head><title>PHP Condtional Operator Operators</title>
    <body>
     <center>
  
<?php
       $n=1;  // 1 to 5
       if($n==1)         
         echo " One";
         if($n==2)         
         echo " Two";
         if($n==3)         
         echo " Three";
         if($n==4)         
         echo " Four";
         if($n==5)         
         echo " Five";
           if($n<1 or $n>5)  
         echo " Invalid number";
       
       
       /* 
          if

          if(condition)
          {
              // Statements 
          }



          if else
          if elseif
          switch case
       */
?>
</center>
</body>
</html>

 

Exit mobile version