Skip to content

each() iterates items in reverse order? #9

Description

@Black-Platypus

When I try to use the each() function, I get all the elements in reverse order.
Using the following:

$htmlcode = "<div>
		<ul>
			<li class='dome'>first</li>
			<li class='dome'>second</li>
			<li>third</li>
			<li class='dome'>fourth</li>
			<li>fifth</li>
			<li class='dome'>sixth</li>
		</ul>
	</div>";
$H = new PowerTools\DOM_Query($htmlcode);
$l = $H->select("li.dome");
$l->each(function($i, $el){
	echo($i . ": " . $el);
});

I get:

3:
sixth
2:
fourth
1:
second
0:
first

What's up with that?
I feel like I shouldn't have to write my own wrapper to make this go from top to bottom.
Am I missing something?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions