Generating a complex unordered list with PHP
<p>I have to display some info in an unordered list like above:</p>

<pre><code>&lt;ul&gt;
  &lt;li class="first"&gt;...&lt;/li&gt;
  &lt;li&gt;...&lt;/li&gt;
  &lt;li class="last"&gt;...&lt;/li&gt;

  &lt;li class="first"&gt;...&lt;/li&gt;
  &lt;li&gt;...&lt;/li&gt;
  &lt;li class="last"&gt;...&lt;/li&gt;

  &lt;li class="first"&gt;...&lt;/li&gt;
  &lt;li&gt;...&lt;/li&gt;
  &lt;li class="last"&gt;...&lt;/li&gt;

  ...
&lt;/ul&gt;
</code></pre>

<p>I need to print this using PHP. </p>

<p>My question is how can I set that class for the first la last element after each three results?</p>

<p>Thank you.</p>
