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 $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/PgP6b
function name:  (null)
number of ops:  18
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        INIT_METHOD_CALL                                         !0, 'multiply'
          9        DO_FCALL                                      0  $5      
         10        ECHO                                                     $5
   24    11        INIT_METHOD_CALL                                         !0, 'subtract'
         12        DO_FCALL                                      0  $6      
         13        ECHO                                                     $6
   25    14        INIT_METHOD_CALL                                         !0, 'divide'
         15        DO_FCALL                                      0  $7      
         16        ECHO                                                     $7
   26    17      > RETURN                                                   1

Class MyCalculator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PgP6b
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/PgP6b
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/PgP6b
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/PgP6b
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/PgP6b
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:
164.47 ms | 1399 KiB | 13 Q