3v4l.org

run code in 300+ PHP versions simultaneously
<?php $totalPages = 3; $xml = new DomDocument('1.0', 'UTF-8'); $xml->formatOutput = true; $html = $xml->createElement('html'); $xml->appendChild($html); $wrapper = $xml->createElement('div'); $wrapper->setAttribute('class', 'wrapper'); $html->appendChild($wrapper); $pages = []; for ($i=1; $i <= $totalPages ; $i++) { $page = $xml->createElement('div'); $page->setAttribute('class', 'pages'); $page->setAttribute( 'id', 'page-' . $i ); $wrapper->appendChild($page); $pages[] = $page; } $wrapper->appendChild($page); $pages[0]->nodeValue = 'Content page-1'; $pages[1]->nodeValue = 'Content page-2'; $pages[2]->nodeValue = 'Content page-3'; echo $xml->saveHTML();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 29
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 29
Branch analysis from position: 50
Branch analysis from position: 29
filename:       /in/YKiTQ
function name:  (null)
number of ops:  66
compiled vars:  !0 = $totalPages, !1 = $xml, !2 = $html, !3 = $wrapper, !4 = $pages, !5 = $i, !6 = $page
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 3
    4     1        NEW                                              $8      'DomDocument'
          2        SEND_VAL_EX                                              '1.0'
          3        SEND_VAL_EX                                              'UTF-8'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $8
    5     6        ASSIGN_OBJ                                               !1, 'formatOutput'
          7        OP_DATA                                                  <true>
    6     8        INIT_METHOD_CALL                                         !1, 'createElement'
          9        SEND_VAL_EX                                              'html'
         10        DO_FCALL                                      0  $12     
         11        ASSIGN                                                   !2, $12
    7    12        INIT_METHOD_CALL                                         !1, 'appendChild'
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0          
    9    15        INIT_METHOD_CALL                                         !1, 'createElement'
         16        SEND_VAL_EX                                              'div'
         17        DO_FCALL                                      0  $15     
         18        ASSIGN                                                   !3, $15
   10    19        INIT_METHOD_CALL                                         !3, 'setAttribute'
         20        SEND_VAL_EX                                              'class'
         21        SEND_VAL_EX                                              'wrapper'
         22        DO_FCALL                                      0          
   11    23        INIT_METHOD_CALL                                         !2, 'appendChild'
         24        SEND_VAR_EX                                              !3
         25        DO_FCALL                                      0          
   13    26        ASSIGN                                                   !4, <array>
   15    27        ASSIGN                                                   !5, 1
         28      > JMP                                                      ->48
   16    29    >   INIT_METHOD_CALL                                         !1, 'createElement'
         30        SEND_VAL_EX                                              'div'
         31        DO_FCALL                                      0  $21     
         32        ASSIGN                                                   !6, $21
   17    33        INIT_METHOD_CALL                                         !6, 'setAttribute'
         34        SEND_VAL_EX                                              'class'
         35        SEND_VAL_EX                                              'pages'
         36        DO_FCALL                                      0          
   18    37        INIT_METHOD_CALL                                         !6, 'setAttribute'
   19    38        SEND_VAL_EX                                              'id'
   20    39        CONCAT                                           ~24     'page-', !5
         40        SEND_VAL_EX                                              ~24
   18    41        DO_FCALL                                      0          
   22    42        INIT_METHOD_CALL                                         !3, 'appendChild'
         43        SEND_VAR_EX                                              !6
         44        DO_FCALL                                      0          
   23    45        ASSIGN_DIM                                               !4
         46        OP_DATA                                                  !6
   15    47        PRE_INC                                                  !5
         48    >   IS_SMALLER_OR_EQUAL                                      !5, !0
         49      > JMPNZ                                                    ~29, ->29
   26    50    >   INIT_METHOD_CALL                                         !3, 'appendChild'
         51        SEND_VAR_EX                                              !6
         52        DO_FCALL                                      0          
   27    53        FETCH_DIM_W                                      $31     !4, 0
         54        ASSIGN_OBJ                                               $31, 'nodeValue'
         55        OP_DATA                                                  'Content+page-1'
   28    56        FETCH_DIM_W                                      $33     !4, 1
         57        ASSIGN_OBJ                                               $33, 'nodeValue'
         58        OP_DATA                                                  'Content+page-2'
   29    59        FETCH_DIM_W                                      $35     !4, 2
         60        ASSIGN_OBJ                                               $35, 'nodeValue'
         61        OP_DATA                                                  'Content+page-3'
   30    62        INIT_METHOD_CALL                                         !1, 'saveHTML'
         63        DO_FCALL                                      0  $37     
         64        ECHO                                                     $37
         65      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.32 ms | 1012 KiB | 13 Q