3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); $array = ["foo", 124, 42, "bar"]; $actions = [ function() use($array, &$actions, &$i) { // Do something with $array[$i] $actions[!isset($array[++$i])](); }, function() { /* abort */ } ]; $i = 0; $actions[!isset($array[$i])](); foreach (get_defined_vars() as $var) { var_dump($var, $$var); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 28
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 28
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/gp22o
function name:  (null)
number of ops:  30
compiled vars:  !0 = $array, !1 = $actions, !2 = $i, !3 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                                 
    5     3        ASSIGN                                                   !0, <array>
    8     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fgp22o%3A8%240'
          5        BIND_LEXICAL                                             ~6, !0
          6        BIND_LEXICAL                                             ~6, !1
          7        BIND_LEXICAL                                             ~6, !2
   11     8        INIT_ARRAY                                       ~7      ~6
   12     9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fgp22o%3A12%241'
         10        ADD_ARRAY_ELEMENT                                ~7      ~8
    7    11        ASSIGN                                                   !1, ~7
   14    12        ASSIGN                                                   !2, 0
   15    13        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     !0, !2
         14        BOOL_NOT                                         ~12     ~11
         15        FETCH_DIM_R                                      ~13     !1, ~12
         16        INIT_DYNAMIC_CALL                                        ~13
         17        DO_FCALL                                      0          
   17    18        INIT_FCALL                                               'get_defined_vars'
         19        DO_ICALL                                         $15     
         20      > FE_RESET_R                                       $16     $15, ->28
         21    > > FE_FETCH_R                                               $16, !3, ->28
   18    22    >   INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !3
         24        FETCH_R                      local               ~17     !3
         25        SEND_VAL                                                 ~17
         26        DO_ICALL                                                 
   17    27      > JMP                                                      ->21
         28    >   FE_FREE                                                  $16
   19    29      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fgp22o%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gp22o
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $array, !1 = $actions, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   10     3        PRE_INC                                          ~3      !2
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      !0, ~3
          5        BOOL_NOT                                         ~5      ~4
          6        FETCH_DIM_R                                      ~6      !1, ~5
          7        INIT_DYNAMIC_CALL                                        ~6
          8        DO_FCALL                                      0          
   11     9      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fgp22o%3A8%240

Function %00%7Bclosure%7D%2Fin%2Fgp22o%3A12%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gp22o
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fgp22o%3A12%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.72 ms | 1400 KiB | 19 Q