3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Factoriel {public function calculate() { if(func_num_args() != 1) throw new Exception ("Invalid arguments count for method calculate!"); if(($n = (int)func_get_arg(0)) <= 0) throw new Exception ("Invalid argument supplied for method calculate!"); $result = 1; foreach(range(1, $n) as $current) $result = $this->multiply ($result, $current); return $result;}private function multiply($left, $right) { return bcmul("$left", "$right"); }}$factoriel = new Factoriel();echo $factoriel->calculate(1500);?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e3GJ8
function name:  (null)
number of ops:  8
compiled vars:  !0 = $factoriel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   NEW                                              $1      'Factoriel'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
          3        INIT_METHOD_CALL                                         !0, 'calculate'
          4        SEND_VAL_EX                                              1500
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7      > RETURN                                                   1

Class Factoriel:
Function calculate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 31
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/e3GJ8
function name:  calculate
number of ops:  34
compiled vars:  !0 = $n, !1 = $result, !2 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   FUNC_NUM_ARGS                                    ~3      
          1        IS_NOT_EQUAL                                             ~3, 1
          2      > JMPZ                                                     ~4, ->7
          3    >   NEW                                              $5      'Exception'
          4        SEND_VAL_EX                                              'Invalid+arguments+count+for+method+calculate%21'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $5
          7    >   INIT_FCALL                                               'func_get_arg'
          8        SEND_VAL                                                 0
          9        DO_ICALL                                         $7      
         10        CAST                                          4  ~8      $7
         11        ASSIGN                                           ~9      !0, ~8
         12        IS_SMALLER_OR_EQUAL                                      ~9, 0
         13      > JMPZ                                                     ~10, ->18
         14    >   NEW                                              $11     'Exception'
         15        SEND_VAL_EX                                              'Invalid+argument+supplied+for+method+calculate%21'
         16        DO_FCALL                                      0          
         17      > THROW                                         0          $11
         18    >   ASSIGN                                                   !1, 1
         19        INIT_FCALL                                               'range'
         20        SEND_VAL                                                 1
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $14     
         23      > FE_RESET_R                                       $15     $14, ->31
         24    > > FE_FETCH_R                                               $15, !2, ->31
         25    >   INIT_METHOD_CALL                                         'multiply'
         26        SEND_VAR_EX                                              !1
         27        SEND_VAR_EX                                              !2
         28        DO_FCALL                                      0  $16     
         29        ASSIGN                                                   !1, $16
         30      > JMP                                                      ->24
         31    >   FE_FREE                                                  $15
         32      > RETURN                                                   !1
         33*     > RETURN                                                   null

End of function calculate

Function multiply:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e3GJ8
function name:  multiply
number of ops:  10
compiled vars:  !0 = $left, !1 = $right
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        INIT_FCALL_BY_NAME                                       'bcmul'
          3        CAST                                          6  ~2      !0
          4        SEND_VAL_EX                                              ~2
          5        CAST                                          6  ~3      !1
          6        SEND_VAL_EX                                              ~3
          7        DO_FCALL                                      0  $4      
          8      > RETURN                                                   $4
          9*     > RETURN                                                   null

End of function multiply

End of class Factoriel.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.05 ms | 1392 KiB | 20 Q