3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
229.61 ms | 2124 KiB | 10 Q