3v4l.org

run code in 300+ PHP versions simultaneously
<?php $root = new DOMDocument(); $root->formatOutput = true; $root->loadXML('<article id=""></article>'); for($i=0;$i<=300;$i++){ $node = new DOMDocument(); $node->loadXML('<section id="'.$i.'"><h1>Überschrift</h1><h2>Überschrift2</h2><p>Content</p></section>'); $xpath = new DOMXPath($node); $query = '//h1'; $entries=$xpath->query($query); if($entries->length===1){ $entries->item(0)->nodeValue = ""; $entries->item(0)->appendChild($node->createTextNode("Text ".$i)); } $node = $root->importNode($node->documentElement, true); $root->documentElement->appendChild($node); } print $root->saveXML();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 10
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 46
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 10
Branch analysis from position: 60
Branch analysis from position: 10
Branch analysis from position: 46
filename:       /in/KAcPY
function name:  (null)
number of ops:  64
compiled vars:  !0 = $root, !1 = $i, !2 = $node, !3 = $xpath, !4 = $query, !5 = $entries
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $6      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $6
    4     3        ASSIGN_OBJ                                               !0, 'formatOutput'
          4        OP_DATA                                                  <true>
    5     5        INIT_METHOD_CALL                                         !0, 'loadXML'
          6        SEND_VAL_EX                                              '%3Carticle+id%3D%22%22%3E%3C%2Farticle%3E'
          7        DO_FCALL                                      0          
    6     8        ASSIGN                                                   !1, 0
          9      > JMP                                                      ->58
    7    10    >   NEW                                              $12     'DOMDocument'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $12
    8    13        INIT_METHOD_CALL                                         !2, 'loadXML'
         14        CONCAT                                           ~15     '%3Csection+id%3D%22', !1
         15        CONCAT                                           ~16     ~15, '%22%3E%3Ch1%3E%C3%9Cberschrift%3C%2Fh1%3E%3Ch2%3E%C3%9Cberschrift2%3C%2Fh2%3E%3Cp%3EContent%3C%2Fp%3E%3C%2Fsection%3E'
         16        SEND_VAL_EX                                              ~16
         17        DO_FCALL                                      0          
    9    18        NEW                                              $18     'DOMXPath'
         19        SEND_VAR_EX                                              !2
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !3, $18
   10    22        ASSIGN                                                   !4, '%2F%2Fh1'
   11    23        INIT_METHOD_CALL                                         !3, 'query'
         24        SEND_VAR_EX                                              !4
         25        DO_FCALL                                      0  $22     
         26        ASSIGN                                                   !5, $22
   12    27        FETCH_OBJ_R                                      ~24     !5, 'length'
         28        IS_IDENTICAL                                             ~24, 1
         29      > JMPZ                                                     ~25, ->46
   13    30    >   INIT_METHOD_CALL                                         !5, 'item'
         31        SEND_VAL_EX                                              0
         32        DO_FCALL                                      0  $26     
         33        SEPARATE                                         $26     $26
         34        ASSIGN_OBJ                                               $26, 'nodeValue'
         35        OP_DATA                                                  ''
   14    36        INIT_METHOD_CALL                                         !5, 'item'
         37        SEND_VAL_EX                                              0
         38        DO_FCALL                                      0  $28     
         39        INIT_METHOD_CALL                                         $28, 'appendChild'
         40        INIT_METHOD_CALL                                         !2, 'createTextNode'
         41        CONCAT                                           ~29     'Text+', !1
         42        SEND_VAL_EX                                              ~29
         43        DO_FCALL                                      0  $30     
         44        SEND_VAR_NO_REF_EX                                       $30
         45        DO_FCALL                                      0          
   17    46    >   INIT_METHOD_CALL                                         !0, 'importNode'
         47        CHECK_FUNC_ARG                                           
         48        FETCH_OBJ_FUNC_ARG                               $32     !2, 'documentElement'
         49        SEND_FUNC_ARG                                            $32
         50        SEND_VAL_EX                                              <true>
         51        DO_FCALL                                      0  $33     
         52        ASSIGN                                                   !2, $33
   18    53        FETCH_OBJ_R                                      ~35     !0, 'documentElement'
         54        INIT_METHOD_CALL                                         ~35, 'appendChild'
         55        SEND_VAR_EX                                              !2
         56        DO_FCALL                                      0          
    6    57        PRE_INC                                                  !1
         58    >   IS_SMALLER_OR_EQUAL                                      !1, 300
         59      > JMPNZ                                                    ~38, ->10
   20    60    >   INIT_METHOD_CALL                                         !0, 'saveXML'
         61        DO_FCALL                                      0  $39     
         62        ECHO                                                     $39
         63      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.07 ms | 1399 KiB | 13 Q