title: convert switch statement to one if only in PHP
body: <p>I am trying to print numbers from 1 to 50. for multiple of 3 it should print "multiple of 3". for multiple of 5 it should print "multiple of 5". for multiple of 3 and 5 it should print "multiple of 3 and 5 both" for other numbers it should print that number.</p>
  
  <p>I tried this below code using switch, it is working. but i can't use switch, ternary  operator or else statement. </p>
  
  <p>Below is my code - </p>
  
  <pre><code>function findMultiples($n)  
  {  
      $three = 3; // To keep track of multiples of 3  
      $five = 5; // To keep track of multiples of 5
  
      for ($i = 1; $i &lt;= $n; $i++)  
      {  
          switch ($i) {
          case $i%$three==0 and $i%$five==0:
              echo "multiple of 3 and 5 both";
              break;
          case $i%$three==0:
              echo "multiple of 3";
              break;
          case $i%$five==0:
              echo "multiple of 5";
              break;
          default:
              echo $i;
          }
  
          echo "&lt;br/&gt;";
      }  
  
  }  
  
  // Driver Code 
  findMultiples(50);  //I am getting expected result.
  </code></pre>
  
  <p>how can i get this result by using below if condition on place of switch</p>
  
  <pre><code>$printNumbers = "";
  
  if (($i%$three==0 and $i%$five==0) or ($i%$three==0) or ($i%$five==0))    
  {  
      $printNumbers = $i;
  }  
  
  echo $printNumbers;
  </code></pre>