PHP - limiting <li> tags in a <ul>
<p>I have the following HTML output;</p>

<pre><code>&lt;ul&gt;
 &lt;li&gt;Test 1&lt;/li&gt;
 &lt;li&gt;Test 2.&lt;/li&gt;
 &lt;li&gt;Test 3&lt;/li&gt;
 &lt;li&gt;Test 4&lt;/li&gt;
 &lt;li&gt;Test 5&lt;/li&gt;
 &lt;li&gt;Test 6&lt;/li&gt;
 &lt;li&gt;Test 7&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>What I need to do, is display the same HTML, but with only the first 4 <code>&lt;li&gt;</code> tags, i.e.</p>

<pre><code>&lt;ul&gt;
 &lt;li&gt;Test 1&lt;/li&gt;
 &lt;li&gt;Test 2.&lt;/li&gt;
 &lt;li&gt;Test 3&lt;/li&gt;
 &lt;li&gt;Test 4&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>Is there an easy way I can do this in PHP?</p>

<p>Thanks</p>

<p>EDIT:</p>

<p>The data is coming from:</p>

<pre><code>$data = $product-&gt;getDescription();
</code></pre>

<p>It is stored in the DB as the HTML content, I am currently displaying it using the above code;</p>

<p>Thanks</p>
