3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(1,2,3,4,5,6,7,8,9); $callback = function($element){ echo($element); }; function walk($a, $index, $callback){ if (count($a) == $index + 1) { $callback($a[$index]); } else { $callback($a[$index]); walk($a, $index + 1); } } walk($array,0, $callback);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UU9VZ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array, !1 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FUU9VZ%3A5%240'
          2        ASSIGN                                                   !1, ~3
   25     3        INIT_FCALL                                               'walk'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 0
          6        SEND_VAR                                                 !1
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FUU9VZ%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UU9VZ
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ECHO                                                     !0
    7     2      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FUU9VZ%3A5%240

Function walk:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UU9VZ
function name:  walk
number of ops:  24
compiled vars:  !0 = $a, !1 = $index, !2 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   11     3        COUNT                                            ~3      !0
          4        ADD                                              ~4      !1, 1
          5        IS_EQUAL                                                 ~3, ~4
          6      > JMPZ                                                     ~5, ->13
   13     7    >   INIT_DYNAMIC_CALL                                        !2
          8        CHECK_FUNC_ARG                                           
          9        FETCH_DIM_FUNC_ARG                               $6      !0, !1
         10        SEND_FUNC_ARG                                            $6
         11        DO_FCALL                                      0          
         12      > JMP                                                      ->23
   17    13    >   INIT_DYNAMIC_CALL                                        !2
         14        CHECK_FUNC_ARG                                           
         15        FETCH_DIM_FUNC_ARG                               $8      !0, !1
         16        SEND_FUNC_ARG                                            $8
         17        DO_FCALL                                      0          
   19    18        INIT_FCALL_BY_NAME                                       'walk'
         19        SEND_VAR_EX                                              !0
         20        ADD                                              ~10     !1, 1
         21        SEND_VAL_EX                                              ~10
         22        DO_FCALL                                      0          
   23    23    > > RETURN                                                   null

End of function walk

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.22 ms | 1403 KiB | 14 Q