<?php $doc = new DOMDocument; $doc->loadHTML(" <html> <body> <p><span>This is mytext :)</span></p> <p><span>This is also MyText :)</span></p> <p><span>MyText at the start :)</span></p> <p><span>Not my text :(</span></p> "); $xpath = new DOMXPath($doc); // Allow calling the stripos() function in XPath $xpath->registerNamespace("php", "http://php.net/xpath"); $xpath->registerPHPFunctions("stripos"); // Example: find <span> elements containing "MyText" (case-insensitive) $nodeList = $xpath->query("//span[php:functionString('stripos', ., 'MyText')]"); foreach ($nodeList as $node) { echo $doc->saveXML($node) . "\n"; }
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`