echo $ul; // gives this code:
<ul id="menu">
<li id="some_id" class="some_class">...</li>
<li id="some_id" class="some_class">...</li>
<li id="some_id" class="some_class">...</li>
</ul>
How to add some class for the first and the last <li>
strong>
Bir regex solution gerekir.
echo $ul;
vermek (biz sınıf my_class
için eklerseniz son <li>
) olmalıdır:
<ul id="menu">
<li id="some_id" class="some_class">...</li>
<li id="some_id" class="some_class">...</li>
<li id="some_id" class="some_class my_class">...</li>
</ul>