title: Change an element's CSS class with PHP
body: <p>How can I change a CSS class of an HTML element in response to a changing page using PHP?</p>
  
  <p>I already got the solution exactly like in <a href="https://stackoverflow.com/questions/195951/change-an-elements-css-class-with-javascript">this</a> but this solution is for Javascript.</p>
  
  <p>Basically, I want to add additional class when a certain IF condition is met.
  This is my code.</p>
  
  <pre><code>&lt;li &lt;?php if ($selected == "profile") echo 'class="active"'; ?&gt; class="dropdown"&gt;
  &lt;a href=""&gt;Profile&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>From my code, you can see that the <code>&lt;li&gt;</code> already got a class in it. So, when I <code>echo</code> another class in <code>IF</code> condition, it completely change to the class in <code>IF</code> condition. </p>
  
  <p>What I need is an extra class, not different class. How can I do that?</p>