I am trying to determine the end of a foreach loop that is seeded with a collection of DOMNodeList. Currently, I am using a for loop would like to avoid having a \'magic\'
$cols->length
Should give you the number of items in the list
for ($i = 0; $i < $cols->length; $i++) { // ... if ($i == $cols->length - 1) { // last column