3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); $arrayKey = '[0][1]'; $a[0][1] = "two levels deep"; $vars = function($str) use ($vars) { $c = function($v, $w) {return $w ? $v[$w] : $v;}; return array_reduce(preg_split('~\[\'|\'\]~', $str), $c, $vars); }; echo $vars('[0][1]');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3obQh
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $arrayKey, !2 = $vars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, '%5B0%5D%5B1%5D'
    6     2        FETCH_DIM_W                                      $5      !0, 0
          3        ASSIGN_DIM                                               $5, 1
          4        OP_DATA                                                  'two+levels+deep'
    8     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3obQh%3A8%240'
          6        BIND_LEXICAL                                             ~7, !2
          7        ASSIGN                                                   !2, ~7
   14     8        INIT_DYNAMIC_CALL                                        !2
          9        SEND_VAL_EX                                              '%5B0%5D%5B1%5D'
         10        DO_FCALL                                      0  $9      
         11        ECHO                                                     $9
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F3obQh%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3obQh
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $str, !1 = $vars, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   10     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3obQh%3A10%241'
          3        ASSIGN                                                   !2, ~3
   11     4        INIT_FCALL                                               'array_reduce'
          5        INIT_FCALL                                               'preg_split'
          6        SEND_VAL                                                 '%7E%5C%5B%27%7C%27%5C%5D%7E'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $6      
         13      > RETURN                                                   $6
   12    14*     > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2F3obQh%3A10%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3obQh
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $v, !1 = $w
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > JMPZ                                                     !1, ->6
          3    >   FETCH_DIM_R                                      ~2      !0, !1
          4        QM_ASSIGN                                        ~3      ~2
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      !0
          7    > > RETURN                                                   ~3
          8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F3obQh%3A10%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.32 ms | 1400 KiB | 17 Q