title: PHP - count li elements inside ul
body: <p>i'm searching for a way to count dynamic li elements inside an ul in php (not js).</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;ul&gt;
  
    &lt;li&gt; lorem &lt;/li&gt;
  
    &lt;li&gt; ipsum &lt;/li&gt;
  
    &lt;li&gt; dolor &lt;/li&gt;
  
    &lt;li&gt; sit &lt;/li&gt;
  
  &lt;/ul&gt;
  </code></pre>
  
  <p>would return me the number <strong>4</strong>.
  (am i too stupid to use proper code here?)</p>
  
  <p>Is there some way to accomplish that in php?</p>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT:</p>
  
  <p>The markup is generated by a cms system, the count should be placed before the list, inside the template file.</p>