3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bcfact($n){ $factorial=$n; while (--$n>1) { echo $n. PHP_EOL; $factorial=bcmul($factorial,$n); } return $factorial; } echo PHP_EOL; echo PHP_EOL; echo PHP_EOL; print bcfact(5); $fact1 = gmp_fact(5.5); // 5 * 4 * 3 * 2 * 1 echo gmp_strval($fact1) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FBbRW
function name:  (null)
number of ops:  17
compiled vars:  !0 = $fact1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     '%0A'
   13     1        ECHO                                                     '%0A'
   14     2        ECHO                                                     '%0A'
   16     3        INIT_FCALL                                               'bcfact'
          4        SEND_VAL                                                 5
          5        DO_FCALL                                      0  $1      
          6        ECHO                                                     $1
   18     7        INIT_FCALL_BY_NAME                                       'gmp_fact'
          8        SEND_VAL_EX                                              5.5
          9        DO_FCALL                                      0  $2      
         10        ASSIGN                                                   !0, $2
   19    11        INIT_FCALL_BY_NAME                                       'gmp_strval'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0  $4      
         14        CONCAT                                           ~5      $4, '%0A'
         15        ECHO                                                     ~5
         16      > RETURN                                                   1

Function bcfact:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
Branch analysis from position: 3
filename:       /in/FBbRW
function name:  bcfact
number of ops:  15
compiled vars:  !0 = $n, !1 = $factorial
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, !0
    5     2      > JMP                                                      ->10
    6     3    >   CONCAT                                           ~3      !0, '%0A'
          4        ECHO                                                     ~3
    7     5        INIT_FCALL_BY_NAME                                       'bcmul'
          6        SEND_VAR_EX                                              !1
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $4      
          9        ASSIGN                                                   !1, $4
    5    10    >   PRE_DEC                                          ~6      !0
         11        IS_SMALLER                                               1, ~6
         12      > JMPNZ                                                    ~7, ->3
    9    13    > > RETURN                                                   !1
   10    14*     > RETURN                                                   null

End of function bcfact

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.94 ms | 1399 KiB | 14 Q