3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyCalculator { private $_fval, $_sval; public function __construct( $fval, $sval ) { $this->_fval = $fval; $this->_sval = $sval; } public function add() { return $this->_fval + $this->_sval; } public function subtract() { return $this->_fval - $this->_sval; } public function multiply() { return $this->_fval * $this->_sval; } public function divide() { return $this->_fval / $this->_sval; } } $mycalc = new MyCalculator(12, 6); echo $mycalc-> add(); // Displays 18 echo '/n'; echo $mycalc-> multiply(); // Displays 72 echo $mycalc-> subtract(); // Displays 6 echo $mycalc-> divide(); // Displays 2 ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Me7uF
function name:  (null)
number of ops:  19
compiled vars:  !0 = $mycalc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'MyCalculator'
          1        SEND_VAL_EX                                              12
          2        SEND_VAL_EX                                              6
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   22     5        INIT_METHOD_CALL                                         !0, 'add'
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
   23     8        ECHO                                                     '%2Fn'
   24     9        INIT_METHOD_CALL                                         !0, 'multiply'
         10        DO_FCALL                                      0  $5      
         11        ECHO                                                     $5
   25    12        INIT_METHOD_CALL                                         !0, 'subtract'
         13        DO_FCALL                                      0  $6      
         14        ECHO                                                     $6
   26    15        INIT_METHOD_CALL                                         !0, 'divide'
         16        DO_FCALL                                      0  $7      
         17        ECHO                                                     $7
   27    18      > RETURN                                                   1

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

End of function __construct

Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Me7uF
function name:  add
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      '_fval'
          1        FETCH_OBJ_R                                      ~1      '_sval'
          2        ADD                                              ~2      ~0, ~1
          3      > RETURN                                                   ~2
   10     4*     > RETURN                                                   null

End of function add

Function subtract:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Me7uF
function name:  subtract
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                      ~0      '_fval'
          1        FETCH_OBJ_R                                      ~1      '_sval'
          2        SUB                                              ~2      ~0, ~1
          3      > RETURN                                                   ~2
   13     4*     > RETURN                                                   null

End of function subtract

Function multiply:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Me7uF
function name:  multiply
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      '_fval'
          1        FETCH_OBJ_R                                      ~1      '_sval'
          2        MUL                                              ~2      ~0, ~1
          3      > RETURN                                                   ~2
   16     4*     > RETURN                                                   null

End of function multiply

Function divide:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Me7uF
function name:  divide
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~0      '_fval'
          1        FETCH_OBJ_R                                      ~1      '_sval'
          2        DIV                                              ~2      ~0, ~1
          3      > RETURN                                                   ~2
   19     4*     > RETURN                                                   null

End of function divide

End of class MyCalculator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.83 ms | 1399 KiB | 13 Q