Answer the question
In order to leave comments, you need to log in
Is it possible to use xpath expressions inside an if condition?
Hello!
Is it possible to use xpath expressions inside an if condition?
Example:
foreach( $elements as $item ) {
// у итерируемого в данный момент элемента class = foo?
if ( $xpath->query( "self::node()[contains(@class, 'foo')]", $item ) ) {
print "yes";
}
else {
print "no";
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question