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($entries->length."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 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 10
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 48
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 10
Branch analysis from position: 62
Branch analysis from position: 10
Branch analysis from position: 48
filename:       /in/Zn1e2
function name:  (null)
number of ops:  66
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                                                      ->60
    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, ->48
   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        FETCH_OBJ_R                                      ~29     !5, 'length'
         42        CONCAT                                           ~30     ~29, 'Text+'
         43        CONCAT                                           ~31     ~30, !1
         44        SEND_VAL_EX                                              ~31
         45        DO_FCALL                                      0  $32     
         46        SEND_VAR_NO_REF_EX                                       $32
         47        DO_FCALL                                      0          
   17    48    >   INIT_METHOD_CALL                                         !0, 'importNode'
         49        CHECK_FUNC_ARG                                           
         50        FETCH_OBJ_FUNC_ARG                               $34     !2, 'documentElement'
         51        SEND_FUNC_ARG                                            $34
         52        SEND_VAL_EX                                              <true>
         53        DO_FCALL                                      0  $35     
         54        ASSIGN                                                   !2, $35
   18    55        FETCH_OBJ_R                                      ~37     !0, 'documentElement'
         56        INIT_METHOD_CALL                                         ~37, 'appendChild'
         57        SEND_VAR_EX                                              !2
         58        DO_FCALL                                      0          
    6    59        PRE_INC                                                  !1
         60    >   IS_SMALLER_OR_EQUAL                                      !1, 300
         61      > JMPNZ                                                    ~40, ->10
   20    62    >   INIT_METHOD_CALL                                         !0, 'saveXML'
         63        DO_FCALL                                      0  $41     
         64        ECHO                                                     $41
         65      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.01 ms | 1399 KiB | 13 Q