Returns the name of the node at the nth position on the stack of open elements, or null if no such position exists.
Description
Note that this uses a 1-based index, which represents the “nth item” on the stack, counting from the top, where the top-most element is the 1st, the second is the 2nd, etc…
Parameters
$nthintrequired- Retrieve the nth item on the stack, with 1 being the top element, 2 being the second, etc…
Source
public function at( int $nth ): ?WP_HTML_Token {
foreach ( $this->walk_down() as $item ) {
if ( 0 === --$nth ) {
return $item;
}
}
return null;
}
Changelog
| Version | Description |
|---|---|
| 6.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.