note 106544 modified in domxpath.query by thiago
| From: | thiago@php.net | Date: | Mon, 28 Nov 2011 12:10:16 +0000 |
| Subject: | note 106544 modified in domxpath.query by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184734@lists.php.net to get a copy of this message | ||
One-liner concat type escape:
<?php
function xpathConcatEscape($string) {
return
"concat(".str_replace(array("'',",",''"),
"",
"'".implode("',\"'\",'",explode("'",$string))."'")
.")";
}
?>
I hate xpath :( This should not be needed.
--was--
One-liner concat type escape:
function xpathConcat($s) {
return
"concat(".ltrim(rtrim("'".implode("',\"'\",'",explode("'",$s))."'",",''"),"'',")
.")";
}
I hate xpath :( This should not be needed.
http://php.net/manual/en/domxpath.query.php