3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $foo = 'initial'; public function get():string {return $this->foo; } public function set(string $bar): A {$this->foo = $bar; return $this;} } class B extends A { public function set(string $bar): B {$this->foo = $bar.'!'; return $this;} } $a = new A; $b = new B; $a->set('A'); $b->set('B'); var_dump([$a->get(), $b->get()]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/90tor
function name:  (null)
number of ops:  22
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   15     3        NEW                                              $5      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   17     6        INIT_METHOD_CALL                                         !0, 'set'
          7        SEND_VAL_EX                                              'A'
          8        DO_FCALL                                      0          
   18     9        INIT_METHOD_CALL                                         !1, 'set'
         10        SEND_VAL_EX                                              'B'
         11        DO_FCALL                                      0          
   20    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !0, 'get'
         14        DO_FCALL                                      0  $10     
         15        INIT_ARRAY                                       ~11     $10
         16        INIT_METHOD_CALL                                         !1, 'get'
         17        DO_FCALL                                      0  $12     
         18        ADD_ARRAY_ELEMENT                                ~11     $12
         19        SEND_VAL                                                 ~11
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

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

End of function get

Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/90tor
function name:  set
number of ops:  8
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'foo'
          2        OP_DATA                                                  !0
          3        FETCH_THIS                                       ~2      
          4        VERIFY_RETURN_TYPE                                       ~2
          5      > RETURN                                                   ~2
          6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function set

End of class A.

Class B:
Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/90tor
function name:  set
number of ops:  9
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        CONCAT                                           ~2      !0, '%21'
          2        ASSIGN_OBJ                                               'foo'
          3        OP_DATA                                                  ~2
          4        FETCH_THIS                                       ~3      
          5        VERIFY_RETURN_TYPE                                       ~3
          6      > RETURN                                                   ~3
          7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function set

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

End of function get

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.62 ms | 1400 KiB | 15 Q