3v4l.org

run code in 300+ PHP versions simultaneously
<?php $svg = <<<SVG <g class="highcharts-legend" transform="translate(217,262)"> <g clip-path="url(#highcharts-9)"> <g transform="translate(0,0)"> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>1</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>2</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>3</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>4</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>5</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>6</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>7</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>8</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>9</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> <g class="highcharts-legend-item"><text x="21" y="15"><tspan>10</tspan></text><rect x="0" y="4" width="16" height="12" fill="#f7a35c"></rect></g> </g> </g> </g> SVG; $dom = new DOMDocument; $dom->loadXML($svg); foreach($dom->getElementsByTagName('g') as $g){ if($g->getAttribute("class") === "highcharts-legend-item"){ $items []= $g; } } for($i = 5; $i < count($items); $i++){ $items[$i]->parentNode->removeChild($items[$i]); } echo $dom->saveXML($dom->documentElement);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 23
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 23
Branch analysis from position: 34
Branch analysis from position: 23
Branch analysis from position: 20
filename:       /in/IS4Yi
function name:  (null)
number of ops:  41
compiled vars:  !0 = $svg, !1 = $dom, !2 = $g, !3 = $items, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cg+class%3D%22highcharts-legend%22++transform%3D%22translate%28217%2C262%29%22%3E%0A%09%3Cg++clip-path%3D%22url%28%23highcharts-9%29%22%3E%0A%09%09%3Cg+transform%3D%22translate%280%2C0%29%22%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E1%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E2%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E3%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E4%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E5%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E6%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E7%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E8%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E9%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%09%3Cg+class%3D%22highcharts-legend-item%22%3E%3Ctext+x%3D%2221%22+y%3D%2215%22%3E%3Ctspan%3E10%3C%2Ftspan%3E%3C%2Ftext%3E%3Crect+x%3D%220%22+y%3D%224%22+width%3D%2216%22+height%3D%2212%22+fill%3D%22%23f7a35c%22%3E%3C%2Frect%3E%3C%2Fg%3E%0A%09%09%3C%2Fg%3E%0A%09%3C%2Fg%3E%0A%3C%2Fg%3E'
   22     1        NEW                                              $6      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $6
   23     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   25     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'g'
          9        DO_FCALL                                      0  $10     
         10      > FE_RESET_R                                       $11     $10, ->20
         11    > > FE_FETCH_R                                               $11, !2, ->20
   26    12    >   INIT_METHOD_CALL                                         !2, 'getAttribute'
         13        SEND_VAL_EX                                              'class'
         14        DO_FCALL                                      0  $12     
         15        IS_IDENTICAL                                             $12, 'highcharts-legend-item'
         16      > JMPZ                                                     ~13, ->19
   27    17    >   ASSIGN_DIM                                               !3
         18        OP_DATA                                                  !2
   25    19    > > JMP                                                      ->11
         20    >   FE_FREE                                                  $11
   31    21        ASSIGN                                                   !4, 5
         22      > JMP                                                      ->31
   32    23    >   FETCH_DIM_R                                      ~16     !3, !4
         24        FETCH_OBJ_R                                      ~17     ~16, 'parentNode'
         25        INIT_METHOD_CALL                                         ~17, 'removeChild'
         26        CHECK_FUNC_ARG                                           
         27        FETCH_DIM_FUNC_ARG                               $18     !3, !4
         28        SEND_FUNC_ARG                                            $18
         29        DO_FCALL                                      0          
   31    30        PRE_INC                                                  !4
         31    >   COUNT                                            ~21     !3
         32        IS_SMALLER                                               !4, ~21
         33      > JMPNZ                                                    ~22, ->23
   35    34    >   INIT_METHOD_CALL                                         !1, 'saveXML'
         35        CHECK_FUNC_ARG                                           
         36        FETCH_OBJ_FUNC_ARG                               $23     !1, 'documentElement'
         37        SEND_FUNC_ARG                                            $23
         38        DO_FCALL                                      0  $24     
         39        ECHO                                                     $24
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.56 ms | 1012 KiB | 13 Q