3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FactorialNum{ protected $_n; public function __construct($n){ $this->_n = $n; } public function result(){ $factorial = 1; for($i=1; $i<=$this->_n;$i++){ $factorial*=$i; } return $factorial; } } $newObj = new FactorialNum(4); echo $newObj->result();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BU6lc
function name:  (null)
number of ops:  8
compiled vars:  !0 = $newObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'FactorialNum'
          1        SEND_VAL_EX                                              4
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   17     4        INIT_METHOD_CALL                                         !0, 'result'
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7      > RETURN                                                   1

Class FactorialNum:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BU6lc
function name:  __construct
number of ops:  4
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN_OBJ                                               '_n'
          2        OP_DATA                                                  !0
    6     3      > RETURN                                                   null

End of function __construct

Function result:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
Branch analysis from position: 3
filename:       /in/BU6lc
function name:  result
number of ops:  10
compiled vars:  !0 = $factorial, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 1
    9     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->5
   10     3    >   ASSIGN_OP                                     3          !0, !1
    9     4        PRE_INC                                                  !1
          5    >   FETCH_OBJ_R                                      ~6      '_n'
          6        IS_SMALLER_OR_EQUAL                                      !1, ~6
          7      > JMPNZ                                                    ~7, ->3
   12     8    > > RETURN                                                   !0
   13     9*     > RETURN                                                   null

End of function result

End of class FactorialNum.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.86 ms | 1395 KiB | 13 Q