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('/path')[0]->asXML('php://output');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ueW98
function name:  (null)
number of ops:  17
compiled vars:  !0 = $string, !1 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%0A%3C%21--+comment++--%3E%0A%3C%21DOCTYPE+svg+PUBLIC+%22-%2F%2FW3C%2F%2FDTD+SVG+1.1%2F%2FEN%22+%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg+version%3D%221.1%22+id%3D%22Layer_1%22+xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22+xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22+x%3D%220px%22+y%3D%220px%22%0A+width%3D%22202.5px%22+height%3D%22226.084px%22+viewBox%3D%220+0+202.5+226.084%22+enable-background%3D%22new+0+0+202.5+226.084%22+xml%3Aspace%3D%22preserve%22%3E%0A+++%3Cg%3E%0A++++++++%3Cpath+d%3D%22M0%2C13.628c47.7940%2C13.628z%22%2F%3E%0A++++++++%3Cpolygon+points%3D%22108.48%2C207.874+145.506%2C196.948+145.506%2C204.536+108.48%2C214.854++%22%2F%3E%0A++++++++%3Cpath+fill%3D%22none%22+stroke%3D%22%23000000%22+d%3D%22M114.55%2C223.959%22%2F%3E%0A+++%3C%2Fg%3E%0A%3C%2Fsvg%3E'
   21     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   23     5        INIT_METHOD_CALL                                         !1, 'registerXPathNamespace'
          6        SEND_VAL_EX                                              'svg'
          7        SEND_VAL_EX                                              'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'
          8        DO_FCALL                                      0          
   25     9        INIT_METHOD_CALL                                         !1, 'xpath'
         10        SEND_VAL_EX                                              '%2Fpath'
         11        DO_FCALL                                      0  $6      
         12        FETCH_DIM_R                                      ~7      $6, 0
         13        INIT_METHOD_CALL                                         ~7, 'asXML'
         14        SEND_VAL_EX                                              'php%3A%2F%2Foutput'
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.08 ms | 1395 KiB | 15 Q