3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = '<?xml version="1.0" encoding="UTF-8"?><svg width="1840.71in" height="2057.42in" viewBox="0 -340 1840.71 2057.42" version="1.1" xmlns="http://www.w3.org/2000/svg" style="stroke-linecap:round;stroke-linejoin:round;fill:none" xmlns:qs="http://xmeasures.com/qs/elements/1.0/"> <text x="22" dx="0" y="-317.43" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 22,-317.43)" text-anchor="start" qs:layer="T-Content">&quot;Client&quot;:</text> <text x="686.64" dx="0" y="-218.92" dy="16" font-family="Arial" font-size="22.4" line-height="1.1" fill="#000000" transform="rotate(360 686.64,-218.92)" text-anchor="start" qs:layer="T-Content">Version:</text> <text x="22" dx="0" y="-277.44" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 22,-277.44)" text-anchor="start" qs:layer="T-Content">Project Name:</text> <text x="22" dx="0" y="-157.43" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 22,-157.43)" text-anchor="start" qs:layer="T-Content">Date Created:</text> <text x="166" dx="0" y="-316.75" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 166,-316.75)" text-anchor="start" qs:layer="T-Project Info">xxxxx</text> <text x="322" dx="0" y="-157.43" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 322,-157.43)" text-anchor="start" qs:layer="T-Content">Date Revised:</text> <text x="22" dx="0" y="-237.43" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 22,-237.43)" text-anchor="start" qs:layer="T-Content">Address:</text> <text x="166" dx="0" y="-237.43" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 166,-237.43)" text-anchor="start" qs:layer="T-Project Info">xxxxx</text> <text x="760" dx="0" y="-263.39" dy="24" font-family="Arial" font-weight="bold" font-size="33.6" line-height="1.1" fill="#000000" transform="rotate(360 760,-263.39)" text-anchor="middle" qs:layer="T-Floor ID">Floor 1</text> <text x="833.36" dx="0" y="-218.93" dy="16" font-family="Arial" font-style="italic" font-size="22.4" line-height="1.1" fill="#ff0000" transform="rotate(360 833.36,-218.93)" text-anchor="end" qs:layer="T-Floor Plan Version">xxxxx</text> <text x="22" dx="0" y="-197.44" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 22,-197.44)" text-anchor="start" qs:layer="T-Content">City, Prov/State:</text> <text x="165.59" dx="0" y="-197.44" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 165.59,-197.44)" text-anchor="start" qs:layer="T-Project Info">xxxxxxx</text> <text x="166" dx="0" y="-277.44" dy="13.33" font-family="Arial" font-size="18.67" line-height="1.1" fill="#000000" transform="rotate(360 166,-277.44)" text-anchor="start" qs:layer="T-Project Info">N/A</text> </svg>'; $document = new \DOMDocument(); $document->loadXML($xml); $xpath = new \DOMXPath($document); $regNS = $xpath->registerNamespace("svg","http://www.w3.org/2000/svg"); $regNS2 = $xpath->registerNamespace("qs","http://xmeasures.com/qs/elements/1.0/"); $xpath1 = $xpath->query("//@qs:layer"); var_dump($xpath1); $xpath2 = $xpath->query("//text[@*='T-Content']"); var_dump($xpath2);
based on U7mpq
Output for 5.3.11 - 5.3.29, 5.4.1 - 7.2.0
object(DOMNodeList)#16 (1) { ["length"]=> int(13) } object(DOMNodeList)#17 (1) { ["length"]=> int(0) }
Output for 5.3.0 - 5.3.10, 5.4.0
object(DOMNodeList)#16 (0) { } object(DOMNodeList)#17 (0) { }
Output for 5.0.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/nHIPI on line 18 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/nHIPI on line 20 object(DOMNodeList)#16 (0) { } object(DOMNodeList)#17 (0) { }
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/nHIPI on line 18 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/nHIPI on line 20 Fatal error: Cannot instantiate non-existent class: domdocument in /in/nHIPI on line 18
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/nHIPI on line 18 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/nHIPI on line 20 Fatal error: Cannot instantiate non-existent class: domdocument in /in/nHIPI on line 18