3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DomDocument('1.0', 'UTF-8'); $doc->formatOutput = true; $iterator = new ArrayIterator([ ['john', 'doe', 'john.doe@example.com'], ['jane', 'doe', 'jane.doe@example.com'], ]); $root = $doc->createElement('table'); foreach ($iterator as $row) { $item = $doc->createElement('tr'); array_walk($row, function ($value) use (&$item, $doc) { $content = $doc->createTextNode($value); $cell = $doc->createElement('td'); $cell->appendChild($content); $item->appendChild($cell); }); $root->appendChild($item); } $doc->appendChild($root); $doc->documentElement->setAttribute('class', 'foo'); echo '<pre>', htmlspecialchars($doc->saveHTML($doc->documentElement));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 32
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 32
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/NR4AU
function name:  (null)
number of ops:  52
compiled vars:  !0 = $doc, !1 = $iterator, !2 = $root, !3 = $row, !4 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $5      'DomDocument'
          1        SEND_VAL_EX                                              '1.0'
          2        SEND_VAL_EX                                              'UTF-8'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $5
    4     5        ASSIGN_OBJ                                               !0, 'formatOutput'
          6        OP_DATA                                                  <true>
    5     7        NEW                                              $9      'ArrayIterator'
    6     8        SEND_VAL_EX                                              <array>
          9        DO_FCALL                                      0          
    5    10        ASSIGN                                                   !1, $9
   10    11        INIT_METHOD_CALL                                         !0, 'createElement'
         12        SEND_VAL_EX                                              'table'
         13        DO_FCALL                                      0  $12     
         14        ASSIGN                                                   !2, $12
   11    15      > FE_RESET_R                                       $14     !1, ->32
         16    > > FE_FETCH_R                                               $14, !3, ->32
   12    17    >   INIT_METHOD_CALL                                         !0, 'createElement'
         18        SEND_VAL_EX                                              'tr'
         19        DO_FCALL                                      0  $15     
         20        ASSIGN                                                   !4, $15
   13    21        INIT_FCALL                                               'array_walk'
         22        SEND_REF                                                 !3
         23        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FNR4AU%3A13%240'
         24        BIND_LEXICAL                                             ~17, !4
         25        BIND_LEXICAL                                             ~17, !0
   18    26        SEND_VAL                                                 ~17
         27        DO_ICALL                                                 
   19    28        INIT_METHOD_CALL                                         !2, 'appendChild'
         29        SEND_VAR_EX                                              !4
         30        DO_FCALL                                      0          
   11    31      > JMP                                                      ->16
         32    >   FE_FREE                                                  $14
   21    33        INIT_METHOD_CALL                                         !0, 'appendChild'
         34        SEND_VAR_EX                                              !2
         35        DO_FCALL                                      0          
   22    36        FETCH_OBJ_R                                      ~21     !0, 'documentElement'
         37        INIT_METHOD_CALL                                         ~21, 'setAttribute'
         38        SEND_VAL_EX                                              'class'
         39        SEND_VAL_EX                                              'foo'
         40        DO_FCALL                                      0          
   23    41        ECHO                                                     '%3Cpre%3E'
         42        INIT_FCALL                                               'htmlspecialchars'
         43        INIT_METHOD_CALL                                         !0, 'saveHTML'
         44        CHECK_FUNC_ARG                                           
         45        FETCH_OBJ_FUNC_ARG                               $23     !0, 'documentElement'
         46        SEND_FUNC_ARG                                            $23
         47        DO_FCALL                                      0  $24     
         48        SEND_VAR                                                 $24
         49        DO_ICALL                                         $25     
         50        ECHO                                                     $25
         51      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FNR4AU%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NR4AU
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $value, !1 = $item, !2 = $doc, !3 = $content, !4 = $cell
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   14     3        INIT_METHOD_CALL                                         !2, 'createTextNode'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !3, $5
   15     7        INIT_METHOD_CALL                                         !2, 'createElement'
          8        SEND_VAL_EX                                              'td'
          9        DO_FCALL                                      0  $7      
         10        ASSIGN                                                   !4, $7
   16    11        INIT_METHOD_CALL                                         !4, 'appendChild'
         12        SEND_VAR_EX                                              !3
         13        DO_FCALL                                      0          
   17    14        INIT_METHOD_CALL                                         !1, 'appendChild'
         15        SEND_VAR_EX                                              !4
         16        DO_FCALL                                      0          
   18    17      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FNR4AU%3A13%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.36 ms | 1400 KiB | 17 Q