3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ClassOne { protected $a = 10; public function changeValue($b) { $this->a = $b; } } class ClassTwo extends ClassOne { protected $b = 10; public function changeValue($b) { $this->b = 10; parent::changeValue($this->a + $this->b); } public function displayValues() { print "a: {$this->a}, b: {$this->b}\n"; } } $obj = new ClassTwo(); $obj->changeValue(0); // Sets b = 10, a = 20 $obj->changeValue(0); // Sets b = 10, a = 30 $obj->displayValues();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k3Zrq
function name:  (null)
number of ops:  12
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $1      'ClassTwo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   28     3        INIT_METHOD_CALL                                         !0, 'changeValue'
          4        SEND_VAL_EX                                              0
          5        DO_FCALL                                      0          
   29     6        INIT_METHOD_CALL                                         !0, 'changeValue'
          7        SEND_VAL_EX                                              0
          8        DO_FCALL                                      0          
   31     9        INIT_METHOD_CALL                                         !0, 'displayValues'
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Class ClassOne:
Function changevalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k3Zrq
function name:  changeValue
number of ops:  4
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function changevalue

End of class ClassOne.

Class ClassTwo:
Function changevalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k3Zrq
function name:  changeValue
number of ops:  10
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'b'
          2        OP_DATA                                                  10
   18     3        INIT_STATIC_METHOD_CALL                                  'changeValue'
          4        FETCH_OBJ_R                                      ~2      'a'
          5        FETCH_OBJ_R                                      ~3      'b'
          6        ADD                                              ~4      ~2, ~3
          7        SEND_VAL_EX                                              ~4
          8        DO_FCALL                                      0          
   19     9      > RETURN                                                   null

End of function changevalue

Function displayvalues:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k3Zrq
function name:  displayValues
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ROPE_INIT                                     5  ~3      'a%3A+'
          1        FETCH_OBJ_R                                      ~0      'a'
          2        ROPE_ADD                                      1  ~3      ~3, ~0
          3        ROPE_ADD                                      2  ~3      ~3, '%2C+b%3A+'
          4        FETCH_OBJ_R                                      ~1      'b'
          5        ROPE_ADD                                      3  ~3      ~3, ~1
          6        ROPE_END                                      4  ~2      ~3, '%0A'
          7        ECHO                                                     ~2
   23     8      > RETURN                                                   null

End of function displayvalues

End of class ClassTwo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.18 ms | 1399 KiB | 13 Q