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.'" data-country="DEU"><h1>Überschrift</h1><h2>Überschrift2</h2><p>Content</p></section>'); $xpath = new DOMXPath($node); $query = '//section'; $entries=$xpath->query($query); $entries->removeAttribute('data-country'); $entries->setAttribute("data-country", substr(md5(rand()),0,7)); $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 = 107
Branch analysis from position: 107
2 jumps found. (Code = 44) Position 1 = 109, Position 2 = 10
Branch analysis from position: 109
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 68
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 95
Branch analysis from position: 76
2 jumps found. (Code = 44) Position 1 = 109, Position 2 = 10
Branch analysis from position: 109
Branch analysis from position: 10
Branch analysis from position: 95
Branch analysis from position: 68
filename:       /in/JdsF1
function name:  (null)
number of ops:  113
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                                                      ->107
    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+data-country%3D%22DEU%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
   12    22        ASSIGN                                                   !4, '%2F%2Fsection'
   13    23        INIT_METHOD_CALL                                         !3, 'query'
         24        SEND_VAR_EX                                              !4
         25        DO_FCALL                                      0  $22     
         26        ASSIGN                                                   !5, $22
   15    27        INIT_METHOD_CALL                                         !5, 'removeAttribute'
         28        SEND_VAL_EX                                              'data-country'
         29        DO_FCALL                                      0          
   16    30        INIT_METHOD_CALL                                         !5, 'setAttribute'
         31        SEND_VAL_EX                                              'data-country'
         32        INIT_FCALL                                               'substr'
         33        INIT_FCALL                                               'md5'
         34        INIT_FCALL                                               'rand'
         35        DO_ICALL                                         $25     
         36        SEND_VAR                                                 $25
         37        DO_ICALL                                         $26     
         38        SEND_VAR                                                 $26
         39        SEND_VAL                                                 0
         40        SEND_VAL                                                 7
         41        DO_ICALL                                         $27     
         42        SEND_VAR_NO_REF_EX                                       $27
         43        DO_FCALL                                      0          
   18    44        ASSIGN                                                   !4, '%2F%2Fh1'
   19    45        INIT_METHOD_CALL                                         !3, 'query'
         46        SEND_VAR_EX                                              !4
         47        DO_FCALL                                      0  $30     
         48        ASSIGN                                                   !5, $30
   20    49        FETCH_OBJ_R                                      ~32     !5, 'length'
         50        IS_IDENTICAL                                             ~32, 1
         51      > JMPZ                                                     ~33, ->68
   21    52    >   INIT_METHOD_CALL                                         !5, 'item'
         53        SEND_VAL_EX                                              0
         54        DO_FCALL                                      0  $34     
         55        SEPARATE                                         $34     $34
         56        ASSIGN_OBJ                                               $34, 'nodeValue'
         57        OP_DATA                                                  ''
   22    58        INIT_METHOD_CALL                                         !5, 'item'
         59        SEND_VAL_EX                                              0
         60        DO_FCALL                                      0  $36     
         61        INIT_METHOD_CALL                                         $36, 'appendChild'
         62        INIT_METHOD_CALL                                         !2, 'createTextNode'
         63        CONCAT                                           ~37     'Text+', !1
         64        SEND_VAL_EX                                              ~37
         65        DO_FCALL                                      0  $38     
         66        SEND_VAR_NO_REF_EX                                       $38
         67        DO_FCALL                                      0          
   25    68    >   ASSIGN                                                   !4, '%2F%2Fh2'
   26    69        INIT_METHOD_CALL                                         !3, 'query'
         70        SEND_VAR_EX                                              !4
         71        DO_FCALL                                      0  $41     
         72        ASSIGN                                                   !5, $41
   27    73        FETCH_OBJ_R                                      ~43     !5, 'length'
         74        IS_IDENTICAL                                             ~43, 1
         75      > JMPZ                                                     ~44, ->95
   28    76    >   INIT_METHOD_CALL                                         !5, 'item'
         77        SEND_VAL_EX                                              0
         78        DO_FCALL                                      0  $45     
         79        SEPARATE                                         $45     $45
         80        ASSIGN_OBJ                                               $45, 'nodeValue'
         81        OP_DATA                                                  ''
   29    82        INIT_METHOD_CALL                                         !5, 'item'
         83        SEND_VAL_EX                                              0
         84        DO_FCALL                                      0  $47     
         85        INIT_METHOD_CALL                                         $47, 'appendChild'
         86        INIT_METHOD_CALL                                         !2, 'createTextNode'
         87        INIT_FCALL                                               'md5'
         88        CONCAT                                           ~48     'Text+', !1
         89        SEND_VAL                                                 ~48
         90        DO_ICALL                                         $49     
         91        SEND_VAR_NO_REF_EX                                       $49
         92        DO_FCALL                                      0  $50     
         93        SEND_VAR_NO_REF_EX                                       $50
         94        DO_FCALL                                      0          
   32    95    >   INIT_METHOD_CALL                                         !0, 'importNode'
         96        CHECK_FUNC_ARG                                           
         97        FETCH_OBJ_FUNC_ARG                               $52     !2, 'documentElement'
         98        SEND_FUNC_ARG                                            $52
         99        SEND_VAL_EX                                              <true>
        100        DO_FCALL                                      0  $53     
        101        ASSIGN                                                   !2, $53
   33   102        FETCH_OBJ_R                                      ~55     !0, 'documentElement'
        103        INIT_METHOD_CALL                                         ~55, 'appendChild'
        104        SEND_VAR_EX                                              !2
        105        DO_FCALL                                      0          
    7   106        PRE_INC                                                  !1
        107    >   IS_SMALLER_OR_EQUAL                                      !1, 300
        108      > JMPNZ                                                    ~58, ->10
   37   109    >   INIT_METHOD_CALL                                         !0, 'saveXML'
        110        DO_FCALL                                      0  $59     
        111        ECHO                                                     $59
        112      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.39 ms | 1404 KiB | 19 Q