3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fibMemo = call_user_func(function () { $memo = array(0 => 0, 1 => 1); $fib = function ($n) use (&$memo, &$fib) { if (!isset($memo[$n])) { $memo[$n] = $fib($n - 1) + $fib($n - 2); } return $memo[$n]; }; return $fib; }); echo $fibMemo(10);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mTrO4
function name:  (null)
number of ops:  9
compiled vars:  !0 = $fibMemo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmTrO4%3A5%240'
   23     1        INIT_USER_CALL                                0          'call_user_func', ~1
          2        DO_FCALL                                      0  $2      
    5     3        ASSIGN                                                   !0, $2
   27     4        INIT_DYNAMIC_CALL                                        !0
          5        SEND_VAL_EX                                              10
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FmTrO4%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mTrO4
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $memo, !1 = $fib
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, <array>
    9     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmTrO4%3A9%241'
          2        BIND_LEXICAL                                             ~3, !0
          3        BIND_LEXICAL                                             ~3, !1
          4        ASSIGN                                                   !1, ~3
   21     5      > RETURN                                                   !1
   23     6*     > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2FmTrO4%3A9%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/mTrO4
function name:  {closure}
number of ops:  20
compiled vars:  !0 = $n, !1 = $memo, !2 = $fib
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   11     3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !1, !0
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->17
   13     6    >   INIT_DYNAMIC_CALL                                        !2
          7        SUB                                              ~6      !0, 1
          8        SEND_VAL_EX                                              ~6
          9        DO_FCALL                                      0  $7      
         10        INIT_DYNAMIC_CALL                                        !2
         11        SUB                                              ~8      !0, 2
         12        SEND_VAL_EX                                              ~8
         13        DO_FCALL                                      0  $9      
         14        ADD                                              ~10     $7, $9
         15        ASSIGN_DIM                                               !1, !0
         16        OP_DATA                                                  ~10
   17    17    >   FETCH_DIM_R                                      ~11     !1, !0
         18      > RETURN                                                   ~11
   19    19*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FmTrO4%3A9%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.78 ms | 1390 KiB | 13 Q