title: If variable equals multiple strings in a navigation list
body: <p>I found something similar to this question but it wasn't related to strings. I'm just looking for the best way to write the following code, I figured there has to be some short version I don't know about.</p>
  
  <pre><code>&lt;ul id="top-nav"&gt;
      &lt;li &lt;?php if($filename == "index.php"){echo ("class=\"current\"");} ?&gt;&gt;&lt;a href="index.php" title="Home"&gt;Home&lt;/a&gt;&lt;/li&gt;
      &lt;li &lt;?php if($filename == "cause.php"){echo ("class=\"current\"");} ?&gt;&gt;&lt;a href="cause.php" title="Cause"&gt;Cause&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="order.php" title="Order"&gt;Order&lt;/a&gt;&lt;/li&gt;
      &lt;li class="drop-down&lt;?php if($filename == "grand-prize-one.php" | $filename == "grand-prize-two.php"){echo (" current");} ?&gt;"&gt;&lt;a href="grand-prize-one.php" title="Grand Prizes"&gt;Grand Prizes&lt;/a&gt;
        &lt;ul&gt;
          &lt;li&gt;&lt;a href="grand-prize-one.php" title="Grand Prize One"&gt;Grand Prize One&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="grand-prize-two.php" title="Grand Prize Two"&gt;Grand Prize Two&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li &lt;?php if($filename == "early-bird.php"){echo ("class=\"current\"");} ?&gt;&gt;&lt;a href="early-bird.php" title="Early Bird"&gt;Early Bird&lt;/a&gt;&lt;/li&gt;
      &lt;li class="drop-down&lt;?php if($filename == "vehicles.php" || $filename == "vacations.php" || $filename == "other-prizes.php"){echo (" current");} ?&gt;"&gt;&lt;a href="vehicles.php" title="Electronics &amp;amp; more"&gt;Other Prizes&lt;/a&gt;
        &lt;ul&gt;
          &lt;li&gt;&lt;a href="vehicles.php" title="Vehicles"&gt;Vehicles&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="vacations.php" title="Vacations"&gt;Vacations&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="other-prizes.php" title="Electronics &amp;amp; more"&gt;Electronics &amp;amp; more&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li &lt;?php if($filename == "winners.php"){echo ("class=\"current\"");} ?&gt;&gt;&lt;a href="winners.php" title="Winners"&gt;Winners&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  </code></pre>
  
  <p>Is there a shorter way to write <code>$filename == "vehicles.php" || $filename == "vacations.php" || $filename == "other-prizes.php"</code>? I doubt I'd ever need it to accommodate more the 5-10 possible strings.</p>
  
  <p>Thank you</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>For those who find this question, I ended up doing this:</p>
  
  <p><em>With my main PHP</em></p>
  
  <pre><code>&lt;?php
   // My other code
   $grandPrizes = array("grand-prize-one.php","grand-prize-two.php");
   $otherPrizes = array("vehicles.php","vacations.php","other-prizes.php");
  ?&gt;
  </code></pre>
  
  <p><em>My inline PHP in the li element</em></p>
  
  <pre><code>&lt;?php if (in_array($filename, $grandPrizes)) {echo " current";} ?&gt;
  </code></pre>