0

If I had this markup:

<div class="some-class">
    <a href="#">Link 1</a>
    <a href="#">Link 2</a>
</div>

would it be possible to test, with PHP, if each of the links are the first or second-childs and then assign them classes based on that? I've been looking into the PHP DOMElement class but I'm not good enough at PHP to put it into practice.

Thanks for any help :)

Tom Oakley
  • 5,218
  • 7
  • 37
  • 64

0 Answers0