3v4l.org

run code in 300+ PHP versions simultaneously
<?php function loop($array) { echo '<ol class="dd-list">'; $arrayObj = new ArrayObject($array); foreach ( $iterator = $arrayObj->getIterator() as $key => $value ) { if(is_array($value)) { loop($iterator->current()); } else { if($iterator->key()=='position') { echo '<li class="dd-item" data-id="' . $iterator->current() . '">'; echo '<div class="dd-handle">' . $iterator->key() . ' ' . $iterator->current() . '</div>'; echo '</li>'; } } } echo '</ol>'; } $testArray = array('1', '2', array('3', '4')); loop($testArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BXhI2
function name:  (null)
number of ops:  5
compiled vars:  !0 = $testArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'loop'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function loop:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 40
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 40
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 39
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 39
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/BXhI2
function name:  loop
number of ops:  43
compiled vars:  !0 = $array, !1 = $arrayObj, !2 = $iterator, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ECHO                                                     '%3Col+class%3D%22dd-list%22%3E'
    4     2        NEW                                              $5      'ArrayObject'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
    5     6        INIT_METHOD_CALL                                         !1, 'getIterator'
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                           ~9      !2, $8
          9      > FE_RESET_R                                       $10     ~9, ->40
         10    > > FE_FETCH_R                                       ~11     $10, !3, ->40
         11    >   ASSIGN                                                   !4, ~11
    6    12        TYPE_CHECK                                  128          !3
         13      > JMPZ                                                     ~13, ->20
    7    14    >   INIT_FCALL_BY_NAME                                       'loop'
         15        INIT_METHOD_CALL                                         !2, 'current'
         16        DO_FCALL                                      0  $14     
         17        SEND_VAR_NO_REF_EX                                       $14
         18        DO_FCALL                                      0          
         19      > JMP                                                      ->39
    9    20    >   INIT_METHOD_CALL                                         !2, 'key'
         21        DO_FCALL                                      0  $16     
         22        IS_EQUAL                                                 $16, 'position'
         23      > JMPZ                                                     ~17, ->39
   10    24    >   INIT_METHOD_CALL                                         !2, 'current'
         25        DO_FCALL                                      0  $18     
         26        CONCAT                                           ~19     '%3Cli+class%3D%22dd-item%22+data-id%3D%22', $18
         27        CONCAT                                           ~20     ~19, '%22%3E'
         28        ECHO                                                     ~20
   11    29        INIT_METHOD_CALL                                         !2, 'key'
         30        DO_FCALL                                      0  $21     
         31        CONCAT                                           ~22     '%3Cdiv+class%3D%22dd-handle%22%3E', $21
         32        CONCAT                                           ~23     ~22, '++'
         33        INIT_METHOD_CALL                                         !2, 'current'
         34        DO_FCALL                                      0  $24     
         35        CONCAT                                           ~25     ~23, $24
         36        CONCAT                                           ~26     ~25, '%3C%2Fdiv%3E'
         37        ECHO                                                     ~26
   12    38        ECHO                                                     '%3C%2Fli%3E'
    5    39    > > JMP                                                      ->10
         40    >   FE_FREE                                                  $10
   16    41        ECHO                                                     '%3C%2Fol%3E'
   17    42      > RETURN                                                   null

End of function loop

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.58 ms | 1402 KiB | 14 Q