DOMXPath::registerPhpFunctionsRegister PHP functions as XPath functions Beschreibung
public void DOMXPath::registerPhpFunctions
([ mixed
$restrict
] )This method enables the ability to use PHP functions within XPath expressions. Parameter-Liste
RückgabewerteEs wird kein Wert zurückgegeben. BeispieleThe following examples use book.xml which contains the following:
Beispiel #1 book.xml <?xml version="1.0" encoding="UTF-8"?> <books> <book> <title>PHP Basics</title> <author>Jim Smith</author> <author>Jane Smith</author> </book> <book> <title>PHP Secrets</title> <author>Jenny Smythe</author> </book> <book> <title>XML basics</title> <author>Joe Black</author> </book> </books>
Beispiel #2 DOMXPath::registerPHPFunctions with php:functionString
<?phpDas oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie: Found 2 books starting with 'PHP': PHP Basics by Jim Smith PHP Secrets by Jenny Smythe
Beispiel #3 DOMXPath::registerPHPFunctions with php:function
<?phpDas oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie: Books with multiple authors: PHP Basics Siehe auch
|