3v4l.org

run code in 500+ PHP versions simultaneously
<?php $fibonnacci = function (int $n, $previous2 = 0, $previous1 = 1) { if ($n <= 1) { return $previous2 + $previous1; } $closure = Closure::getCurrent(); return $closure($n - 1, $previous1, $previous1 + $previous2); }; print $fibonnacci(4);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cdKnN
function name:  (null)
number of ops:  7
compiled vars:  !0 = $fibonnacci
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                              ~1      [0]
          1        ASSIGN                                                       !0, ~1
   12     2        INIT_DYNAMIC_CALL                                            !0
          3        SEND_VAL_EX                                                  4
          4        DO_FCALL                                          0  $3      
          5        ECHO                                                         $3
          6      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cdKnN
function name:  {closure:/in/cdKnN:3}
number of ops:  19
compiled vars:  !0 = $n, !1 = $previous2, !2 = $previous1, !3 = $closure
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      0
          2        RECV_INIT                                            !2      1
    4     3        IS_SMALLER_OR_EQUAL                                          !0, 1
          4      > JMPZ                                                         ~4, ->7
    5     5    >   ADD                                                  ~5      !1, !2
          6      > RETURN                                                       ~5
    8     7    >   INIT_STATIC_METHOD_CALL                                      'Closure', 'getCurrent'
          8        DO_FCALL                                          0  $6      
          9        ASSIGN                                                       !3, $6
    9    10        INIT_DYNAMIC_CALL                                            !3
         11        SUB                                                  ~8      !0, 1
         12        SEND_VAL_EX                                                  ~8
         13        SEND_VAR_EX                                                  !2
         14        ADD                                                  ~9      !2, !1
         15        SEND_VAL_EX                                                  ~9
         16        DO_FCALL                                          0  $10     
         17      > RETURN                                                       $10
   10    18*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.38 ms | 1147 KiB | 13 Q