/ Published in: PHP

I'm using this out of laziness.
PHP is slowing things down here, since it's not as close to C as XPath.
A better solution would be to have an attribute specifically for search purposes (either in upper or lowercase).
PHP is slowing things down here, since it's not as close to C as XPath.
A better solution would be to have an attribute specifically for search purposes (either in upper or lowercase).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$xpath = new DOMXPath($dom); $xpath->registerNamespace("php", "http://php.net/xpath"); $xpath->registerPHPFunctions('strtolower'); $query = "/root/item[contains(@name_es,'$term') or contains(php:functionString('strtolower',@name_es),'$term')]"; } else { // fallback without PHP }
Comments
