3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * How to get SVG tag content with PHP * @link http://stackoverflow.com/a/16234458/367456 */ $string = <<<BUFFER <?xml version="1.0" encoding="utf-8"?> <!-- comment --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="202.5px" height="226.084px" viewBox="0 0 202.5 226.084" enable-background="new 0 0 202.5 226.084" xml:space="preserve"> <g> <path d="M0,13.628c47.7940,13.628z"/> <polygon points="108.48,207.874 145.506,196.948 145.506,204.536 108.48,214.854 "/> <path fill="none" stroke="#000000" d="M114.55,223.959"/> </g> </svg> BUFFER; $xml = simplexml_load_string($string); $xml->registerXPathNamespace('svg', 'http://www.w3.org/2000/svg'); $xml->xpath('/svg/g')[0]->asXML('php://output');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined array key 0 in /in/uZ00U on line 25 Fatal error: Uncaught Error: Call to a member function asXML() on null in /in/uZ00U:25 Stack trace: #0 {main} thrown in /in/uZ00U on line 25
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Undefined offset: 0 in /in/uZ00U on line 25 Fatal error: Uncaught Error: Call to a member function asXML() on null in /in/uZ00U:25 Stack trace: #0 {main} thrown in /in/uZ00U on line 25
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.26
Fatal error: Uncaught Error: Call to a member function asXML() on null in /in/uZ00U:25 Stack trace: #0 {main} thrown in /in/uZ00U on line 25
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Notice: Undefined offset: 0 in /in/uZ00U on line 25 Fatal error: Call to a member function asXML() on null in /in/uZ00U on line 25
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Notice: Undefined offset: 0 in /in/uZ00U on line 25 Fatal error: Call to a member function asXML() on a non-object in /in/uZ00U on line 25
Process exited with code 255.
Output for 4.4.3 - 4.4.9, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/uZ00U on line 25
Process exited with code 255.
Output for 4.4.2, 5.1.2
Parse error: syntax error, unexpected '[' in /in/uZ00U on line 26
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/uZ00U on line 25
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/uZ00U on line 25
Process exited with code 255.

preferences:
303.11 ms | 401 KiB | 456 Q