Skip to content

Commit

Permalink
registerphpfunctionns.xml Remove mentioning restriction (#4494)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalferov authored Feb 26, 2025
1 parent 285d4ca commit 647105f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions reference/dom/domxpath/registerphpfunctionns.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<programlisting role="php">
<![CDATA[
<?php
$xml = <<<EOB
<books>
<book>
Expand All @@ -87,16 +88,16 @@ $xml = <<<EOB
</books>
EOB;
$doc = new DOMDocument;
$doc = new DOMDocument();
$doc->loadXML($xml);
$xpath = new DOMXPath($doc);
// Register the my: namespace (required)
$xpath->registerNamespace("my", "urn:my.ns");
// Register PHP functions (no restrictions)
$xpath->registerPhpFunctionNS(
// Register PHP function
$xpath->registerPHPFunctionNS(
'urn:my.ns',
'substring',
fn (array $arg1, int $start, int $length) => substr($arg1[0]->textContent, $start, $length)
Expand Down

0 comments on commit 647105f

Please sign in to comment.