3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tail_factorial($n, $acc = 1) { if ($n == 1) { return $acc; } return tail_factorial($n-1, $n * $acc); } echo tail_factorial(500);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XSv7R
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'tail_factorial'
          1        SEND_VAL                                                 500
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function tail_factorial:
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/XSv7R
function name:  tail_factorial
number of ops:  13
compiled vars:  !0 = $n, !1 = $acc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      1
    5     2        IS_EQUAL                                                 !0, 1
          3      > JMPZ                                                     ~2, ->5
    6     4    > > RETURN                                                   !1
    8     5    >   INIT_FCALL_BY_NAME                                       'tail_factorial'
          6        SUB                                              ~3      !0, 1
          7        SEND_VAL_EX                                              ~3
          8        MUL                                              ~4      !0, !1
          9        SEND_VAL_EX                                              ~4
         10        DO_FCALL                                      0  $5      
         11      > RETURN                                                   $5
    9    12*     > RETURN                                                   null

End of function tail_factorial

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.2 ms | 1397 KiB | 14 Q