3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Counter { private $counter = 0; private function getCount() { return $this->counter; } public function increment() { $this->counter = $this->getCount() + 1; } } class CounterOfssetByOne extends Counter { public function getCount() { return parent::getCount() + 1; } } $counter = new CounterOfssetByOne; $counter->increment(); $counter->increment(); var_dump($counter->getCount());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qp778
function name:  (null)
number of ops:  13
compiled vars:  !0 = $counter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $1      'CounterOfssetByOne'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'increment'
          4        DO_FCALL                                      0          
   16     5        INIT_METHOD_CALL                                         !0, 'increment'
          6        DO_FCALL                                      0          
   17     7        INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !0, 'getCount'
          9        DO_FCALL                                      0  $6      
         10        SEND_VAR                                                 $6
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Class Counter:
Function getcount:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qp778
function name:  getCount
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_OBJ_R                                      ~0      'counter'
          1      > RETURN                                                   ~0
          2*     > RETURN                                                   null

End of function getcount

Function increment:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qp778
function name:  increment
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_METHOD_CALL                                         'getCount'
          1        DO_FCALL                                      0  $1      
          2        ADD                                              ~2      $1, 1
          3        ASSIGN_OBJ                                               'counter'
          4        OP_DATA                                                  ~2
          5      > RETURN                                                   null

End of function increment

End of class Counter.

Class CounterOfssetByOne:
Function getcount:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qp778
function name:  getCount
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_STATIC_METHOD_CALL                                  'getCount'
          1        DO_FCALL                                      0  $0      
          2        ADD                                              ~1      $0, 1
          3      > RETURN                                                   ~1
          4*     > RETURN                                                   null

End of function getcount

Function increment:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qp778
function name:  increment
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_METHOD_CALL                                         'getCount'
          1        DO_FCALL                                      0  $1      
          2        ADD                                              ~2      $1, 1
          3        ASSIGN_OBJ                                               'counter'
          4        OP_DATA                                                  ~2
          5      > RETURN                                                   null

End of function increment

End of class CounterOfssetByOne.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.21 ms | 1400 KiB | 15 Q