title: If within Switch - Case in php
body: <p>I am trying to create a query from the data i receive from an array of objects in php. I keep receiving an error on the nested if inside a case. unexpected '{', is it because I can't have an if within a case?</p>
  
  <pre><code>switch($name){ 
  case 'players': 
        $query .= " min_players &lt;=".$value." AND max_players &gt;=".$value." AND"; 
        break; 
  case 'max-duration':         
        if((intval($value) &gt;= 45)  {  
            $min = intval($value)-30;  
            $query .= " duration &lt;=".$value." AND duration &gt;=".$min." AND"; 
        } else { //if duration &lt; 45  
              $query .= " duration &lt;=".$value." AND";  
        }//end else 
        break; 
  }
  </code></pre>