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)); } $query = '//h2'; $entries=$xpath->query($query); if($entries->length===1){ $entries->item(0)->nodeValue = ""; $entries->item(0)->appendChild($node->createTextNode(md5("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 = 85
Branch analysis from position: 85
2 jumps found. (Code = 44) Position 1 = 87, Position 2 = 10
Branch analysis from position: 87
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 = 43) Position 1 = 54, Position 2 = 73
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 87, Position 2 = 10
Branch analysis from position: 87
Branch analysis from position: 10
Branch analysis from position: 73
Branch analysis from position: 46
filename:       /in/BfSs4
function name:  (null)
number of ops:  91
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          
    7     8        ASSIGN                                                   !1, 0
          9      > JMP                                                      ->85
    8    10    >   NEW                                              $12     'DOMDocument'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $12
    9    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          
   10    18        NEW                                              $18     'DOMXPath'
         19        SEND_VAR_EX                                              !2
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !3, $18
   11    22        ASSIGN                                                   !4, '%2F%2Fh1'
   12    23        INIT_METHOD_CALL                                         !3, 'query'
         24        SEND_VAR_EX                                              !4
         25        DO_FCALL                                      0  $22     
         26        ASSIGN                                                   !5, $22
   13    27        FETCH_OBJ_R                                      ~24     !5, 'length'
         28        IS_IDENTICAL                                             ~24, 1
         29      > JMPZ                                                     ~25, ->46
   14    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                                                  ''
   15    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          
   18    46    >   ASSIGN                                                   !4, '%2F%2Fh2'
   19    47        INIT_METHOD_CALL                                         !3, 'query'
         48        SEND_VAR_EX                                              !4
         49        DO_FCALL                                      0  $33     
         50        ASSIGN                                                   !5, $33
   20    51        FETCH_OBJ_R                                      ~35     !5, 'length'
         52        IS_IDENTICAL                                             ~35, 1
         53      > JMPZ                                                     ~36, ->73
   21    54    >   INIT_METHOD_CALL                                         !5, 'item'
         55        SEND_VAL_EX                                              0
         56        DO_FCALL                                      0  $37     
         57        SEPARATE                                         $37     $37
         58        ASSIGN_OBJ                                               $37, 'nodeValue'
         59        OP_DATA                                                  ''
   22    60        INIT_METHOD_CALL                                         !5, 'item'
         61        SEND_VAL_EX                                              0
         62        DO_FCALL                                      0  $39     
         63        INIT_METHOD_CALL                                         $39, 'appendChild'
         64        INIT_METHOD_CALL                                         !2, 'createTextNode'
         65        INIT_FCALL                                               'md5'
         66        CONCAT                                           ~40     'Text+', !1
         67        SEND_VAL                                                 ~40
         68        DO_ICALL                                         $41     
         69        SEND_VAR_NO_REF_EX                                       $41
         70        DO_FCALL                                      0  $42     
         71        SEND_VAR_NO_REF_EX                                       $42
         72        DO_FCALL                                      0          
   25    73    >   INIT_METHOD_CALL                                         !0, 'importNode'
         74        CHECK_FUNC_ARG                                           
         75        FETCH_OBJ_FUNC_ARG                               $44     !2, 'documentElement'
         76        SEND_FUNC_ARG                                            $44
         77        SEND_VAL_EX                                              <true>
         78        DO_FCALL                                      0  $45     
         79        ASSIGN                                                   !2, $45
   26    80        FETCH_OBJ_R                                      ~47     !0, 'documentElement'
         81        INIT_METHOD_CALL                                         ~47, 'appendChild'
         82        SEND_VAR_EX                                              !2
         83        DO_FCALL                                      0          
    7    84        PRE_INC                                                  !1
         85    >   IS_SMALLER_OR_EQUAL                                      !1, 300
         86      > JMPNZ                                                    ~50, ->10
   30    87    >   INIT_METHOD_CALL                                         !0, 'saveXML'
         88        DO_FCALL                                      0  $51     
         89        ECHO                                                     $51
         90      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.11 ms | 1409 KiB | 15 Q