3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $priv; function setPrivA( $x ) { $this->priv = $x; } } class B extends A { private $priv; function setPrivB($foo) { $this->priv = $foo; } } class C extends A { function accessOther( $a ) { return $a->priv; } } $b = new B; $b->setPrivA('foo'); $b->setPrivB('bar'); var_dump( $b ); $c = new C; $c->priv = 'baz'; var_dump( $c ); var_dump( $c->accessOther( $b ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nq2k5
function name:  (null)
number of ops:  27
compiled vars:  !0 = $b, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $2      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   26     3        INIT_METHOD_CALL                                         !0, 'setPrivA'
          4        SEND_VAL_EX                                              'foo'
          5        DO_FCALL                                      0          
   27     6        INIT_METHOD_CALL                                         !0, 'setPrivB'
          7        SEND_VAL_EX                                              'bar'
          8        DO_FCALL                                      0          
   28     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   30    12        NEW                                              $8      'C'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $8
   31    15        ASSIGN_OBJ                                               !1, 'priv'
         16        OP_DATA                                                  'baz'
   32    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
   33    20        INIT_FCALL                                               'var_dump'
         21        INIT_METHOD_CALL                                         !1, 'accessOther'
         22        SEND_VAR_EX                                              !0
         23        DO_FCALL                                      0  $13     
         24        SEND_VAR                                                 $13
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

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

End of function setpriva

End of class A.

Class B:
Function setprivb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nq2k5
function name:  setPrivB
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        ASSIGN_OBJ                                               'priv'
          2        OP_DATA                                                  !0
   16     3      > RETURN                                                   null

End of function setprivb

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

End of function setpriva

End of class B.

Class C:
Function accessother:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nq2k5
function name:  accessOther
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        FETCH_OBJ_R                                      ~1      !0, 'priv'
          2      > RETURN                                                   ~1
   22     3*     > RETURN                                                   null

End of function accessother

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

End of function setpriva

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
190.57 ms | 1400 KiB | 15 Q