3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Factorial { public function calculate ($int) { if (!is_int($int)) { echo "entry is not a number"; } $intStep = $int - 1; do { $int += $intStep; $intStep--; } while ($intStep > 0); return $int; } } $factorial = new Factorial; echo $factorial->calculate(5);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TSbAs
function name:  (null)
number of ops:  8
compiled vars:  !0 = $factorial
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Factorial'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_METHOD_CALL                                         !0, 'calculate'
          4        SEND_VAL_EX                                              5
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7      > RETURN                                                   1

Class Factorial:
Function calculate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 7
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
Branch analysis from position: 5
filename:       /in/TSbAs
function name:  calculate
number of ops:  13
compiled vars:  !0 = $int, !1 = $intStep
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        TYPE_CHECK                                   16  ~2      !0
          2        BOOL_NOT                                         ~3      ~2
          3      > JMPZ                                                     ~3, ->5
    7     4    >   ECHO                                                     'entry+is+not+a+number'
    9     5    >   SUB                                              ~4      !0, 1
          6        ASSIGN                                                   !1, ~4
   11     7    >   ASSIGN_OP                                     1          !0, !1
   12     8        PRE_DEC                                                  !1
   13     9        IS_SMALLER                                               0, !1
         10      > JMPNZ                                                    ~8, ->7
   14    11    > > RETURN                                                   !0
   15    12*     > RETURN                                                   null

End of function calculate

End of class Factorial.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.25 ms | 1007 KiB | 13 Q