3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dom = new DOMDocument(); $dom->loadXML('<?xml version="1.0" encoding="UTF-8"?><svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"><text><svg:tspan>T</svg:tspan></text></svg>'); $text = $dom->getElementsByTagName('text')[0]; $switch = $dom->createElementNS('http://www.w3.org/2000/svg', 'switch'); $text->parentNode->insertBefore($switch, $text); $switch->appendChild($text); echo $dom->saveXML($dom->getElementsByTagName('switch')[0]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YMY6j
function name:  (null)
number of ops:  34
compiled vars:  !0 = $dom, !1 = $text, !2 = $switch
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   NEW                                                  $3      'DOMDocument'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
    3     3        INIT_METHOD_CALL                                             !0, 'loadXML'
          4        SEND_VAL_EX                                                  '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%3Csvg+xmlns%3Asvg%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22+xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctext%3E%3Csvg%3Atspan%3ET%3C%2Fsvg%3Atspan%3E%3C%2Ftext%3E%3C%2Fsvg%3E'
          5        DO_FCALL                                          0          
    4     6        INIT_METHOD_CALL                                             !0, 'getElementsByTagName'
          7        SEND_VAL_EX                                                  'text'
          8        DO_FCALL                                          0  $7      
          9        FETCH_DIM_R                                          ~8      $7, 0
         10        ASSIGN                                                       !1, ~8
    5    11        INIT_METHOD_CALL                                             !0, 'createElementNS'
         12        SEND_VAL_EX                                                  'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'
         13        SEND_VAL_EX                                                  'switch'
         14        DO_FCALL                                          0  $10     
         15        ASSIGN                                                       !2, $10
    6    16        FETCH_OBJ_R                                          ~12     !1, 'parentNode'
         17        INIT_METHOD_CALL                                             ~12, 'insertBefore'
         18        SEND_VAR_EX                                                  !2
         19        SEND_VAR_EX                                                  !1
         20        DO_FCALL                                          0          
    7    21        INIT_METHOD_CALL                                             !2, 'appendChild'
         22        SEND_VAR_EX                                                  !1
         23        DO_FCALL                                          0          
    8    24        INIT_METHOD_CALL                                             !0, 'saveXML'
         25        CHECK_FUNC_ARG                                               
         26        INIT_METHOD_CALL                                             !0, 'getElementsByTagName'
         27        SEND_VAL_EX                                                  'switch'
         28        DO_FCALL                                          0  $15     
         29        FETCH_DIM_FUNC_ARG                                   $16     $15, 0
         30        SEND_FUNC_ARG                                                $16
         31        DO_FCALL                                          0  $17     
         32        ECHO                                                         $17
         33      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
191.99 ms | 1771 KiB | 13 Q