3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DomDocument('1.0', 'UTF-8'); $doc->formatOutput = true; $iterator = new SplTempFileObject(); $iterator->setFlags(SplTempFileObject::READ_CSV); $iterator->fputcsv(array('john', 'doe', 'john.doe@example.com')); $iterator->fputcsv(array('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) { $cell = $doc->createElement('td'); $cell->appendChild($doc->createTextNode($value)); $item->appendChild($cell); }); $root->appendChild($item); } $doc->appendChild($root); $doc->documentElement->setAttribute('class', 'foo'); echo $doc->saveHTML($doc->documentElement);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 40
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 40
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/e9535
function name:  (null)
number of ops:  56
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>
    6     7        NEW                                              $9      'SplTempFileObject'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $9
    7    10        INIT_METHOD_CALL                                         !1, 'setFlags'
         11        SEND_VAL_EX                                              8
         12        DO_FCALL                                      0          
    8    13        INIT_METHOD_CALL                                         !1, 'fputcsv'
         14        SEND_VAL_EX                                              <array>
         15        DO_FCALL                                      0          
    9    16        INIT_METHOD_CALL                                         !1, 'fputcsv'
         17        SEND_VAL_EX                                              <array>
         18        DO_FCALL                                      0          
   11    19        INIT_METHOD_CALL                                         !0, 'createElement'
         20        SEND_VAL_EX                                              'table'
         21        DO_FCALL                                      0  $15     
         22        ASSIGN                                                   !2, $15
   12    23      > FE_RESET_R                                       $17     !1, ->40
         24    > > FE_FETCH_R                                               $17, !3, ->40
   13    25    >   INIT_METHOD_CALL                                         !0, 'createElement'
         26        SEND_VAL_EX                                              'tr'
         27        DO_FCALL                                      0  $18     
         28        ASSIGN                                                   !4, $18
   14    29        INIT_FCALL                                               'array_walk'
         30        SEND_REF                                                 !3
         31        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fe9535%3A14%240'
         32        BIND_LEXICAL                                             ~20, !4
         33        BIND_LEXICAL                                             ~20, !0
   18    34        SEND_VAL                                                 ~20
         35        DO_ICALL                                                 
   19    36        INIT_METHOD_CALL                                         !2, 'appendChild'
         37        SEND_VAR_EX                                              !4
         38        DO_FCALL                                      0          
   12    39      > JMP                                                      ->24
         40    >   FE_FREE                                                  $17
   21    41        INIT_METHOD_CALL                                         !0, 'appendChild'
         42        SEND_VAR_EX                                              !2
         43        DO_FCALL                                      0          
   22    44        FETCH_OBJ_R                                      ~24     !0, 'documentElement'
         45        INIT_METHOD_CALL                                         ~24, 'setAttribute'
         46        SEND_VAL_EX                                              'class'
         47        SEND_VAL_EX                                              'foo'
         48        DO_FCALL                                      0          
   23    49        INIT_METHOD_CALL                                         !0, 'saveHTML'
         50        CHECK_FUNC_ARG                                           
         51        FETCH_OBJ_FUNC_ARG                               $26     !0, 'documentElement'
         52        SEND_FUNC_ARG                                            $26
         53        DO_FCALL                                      0  $27     
         54        ECHO                                                     $27
         55      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2Fe9535%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.38 ms | 1392 KiB | 15 Q