3v4l.org

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


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v6hH9
function name:  {closure:/in/v6hH9:3}
number of ops:  12
compiled vars:  !0 = $n, !1 = $factorial
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
    4     2        IS_IDENTICAL                                                 !0, 1
          3      > JMPZ                                                         ~2, ->5
    5     4    > > RETURN                                                       1
    8     5    >   INIT_DYNAMIC_CALL                                            !1
          6        SUB                                                  ~3      !0, 1
          7        SEND_VAL_EX                                                  ~3
          8        DO_FCALL                                          0  $4      
          9        MUL                                                  ~5      !0, $4
         10      > RETURN                                                       ~5
    9    11*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.96 ms | 1462 KiB | 13 Q