Finds the next tag matching the $query.
Parameters
$query
array|string|nulloptional- Which tag name to find, having which class, etc. Default is to find any tag.
tag_name
string|nullWhich tag to find, ornull
for "any tag."match_offset
int|nullFind the Nth tag matching all search criteria.
1 for "first" tag, 3 for "third," etc.
Defaults to first tag.class_name
string|nullTag must contain this whole class name to match.tag_closers
string|null"visit" or "skip": whether to stop on tag closers, e.g. </div>.
Default:
null
Source
public function next_tag( $query = null ) {
$this->parse_query( $query );
$already_found = 0;
do {
if ( false === $this->next_token() ) {
return false;
}
if ( self::STATE_MATCHED_TAG !== $this->parser_state ) {
continue;
}
if ( $this->matches() ) {
++$already_found;
}
} while ( $already_found < $this->sought_match_offset );
return true;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.