3v4l.org

run code in 300+ PHP versions simultaneously
<?php function loop($array) { echo '<ol class="dd-list">'; echo "\n"; foreach ( $array as $key => $value ) { if(is_array($value)) { loop($value); } else { echo '<li class="dd-item" data-id="' . $value . '">'; echo '<div class="dd-handle">' . $key . ' => ' . $value . '</div>'; echo '</li>'; echo "\n"; } } echo '</ol>'; } $testArray = array('1', '2', array('3', '4')); /* $arrayObj = new ArrayObject($testArray); foreach ( $iterator = $arrayObj->getIterator() as $key => $value ) { echo 'key ' . $iterator->key(); echo "\n"; echo 'current' . $iterator->current(); echo "\n"; echo "\n"; } */ loop($testArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9LkAZ
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>
   30     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 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 23
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/9LkAZ
function name:  loop
number of ops:  26
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ECHO                                                     '%3Col+class%3D%22dd-list%22%3E'
    5     2        ECHO                                                     '%0A'
    6     3      > FE_RESET_R                                       $3      !0, ->23
          4    > > FE_FETCH_R                                       ~4      $3, !1, ->23
          5    >   ASSIGN                                                   !2, ~4
    7     6        TYPE_CHECK                                  128          !1
          7      > JMPZ                                                     ~6, ->12
    8     8    >   INIT_FCALL_BY_NAME                                       'loop'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
         11      > JMP                                                      ->22
   10    12    >   CONCAT                                           ~8      '%3Cli+class%3D%22dd-item%22+data-id%3D%22', !1
         13        CONCAT                                           ~9      ~8, '%22%3E'
         14        ECHO                                                     ~9
   11    15        CONCAT                                           ~10     '%3Cdiv+class%3D%22dd-handle%22%3E', !2
         16        CONCAT                                           ~11     ~10, '+%3D%3E+'
         17        CONCAT                                           ~12     ~11, !1
         18        CONCAT                                           ~13     ~12, '%3C%2Fdiv%3E'
         19        ECHO                                                     ~13
   12    20        ECHO                                                     '%3C%2Fli%3E'
   13    21        ECHO                                                     '%0A'
    6    22    > > JMP                                                      ->4
         23    >   FE_FREE                                                  $3
   16    24        ECHO                                                     '%3C%2Fol%3E'
   17    25      > RETURN                                                   null

End of function loop

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.8 ms | 1402 KiB | 14 Q