3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Amount { private $_list = array(); protected $_number; public function __construct($number) { $this->_number = $number; } public function add(Amount $a) { array_push($this->_list, $this->_number); unset($this->_number); array_push($this->_list, $a->_number); $this->_number += $a->_number; } } $x = new Amount(2); $y = new Amount(3); var_dump($x->add($y));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g3s78
function name:  (null)
number of ops:  15
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $2      'Amount'
          1        SEND_VAL_EX                                              2
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   23     4        NEW                                              $5      'Amount'
          5        SEND_VAL_EX                                              3
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   25     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'add'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class Amount:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g3s78
function name:  __construct
number of ops:  4
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               '_number'
          2        OP_DATA                                                  !0
   10     3      > 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/g3s78
function name:  add
number of ops:  18
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'array_push'
          2        FETCH_OBJ_W                                      $1      '_list'
          3        SEND_REF                                                 $1
          4        FETCH_OBJ_R                                      ~2      '_number'
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                                 
   15     7        UNSET_OBJ                                                '_number'
   16     8        INIT_FCALL                                               'array_push'
          9        FETCH_OBJ_W                                      $4      '_list'
         10        SEND_REF                                                 $4
         11        FETCH_OBJ_R                                      ~5      !0, '_number'
         12        SEND_VAL                                                 ~5
         13        DO_ICALL                                                 
   18    14        FETCH_OBJ_R                                      ~8      !0, '_number'
         15        ASSIGN_OBJ_OP                                 1          '_number'
         16        OP_DATA                                                  ~8
   19    17      > RETURN                                                   null

End of function add

End of class Amount.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
186.92 ms | 1404 KiB | 17 Q