3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar = 'baz'; public function __construct() { unset($this->bar); } public function getFooBar() { return $this->bar; } } class Bar extends Foo { private $bar = 'baz'; public function __construct() { parent::__construct(); unset($this->bar); } public function getBarBar() { return $this->bar; } } $bar = new Bar(); var_dump($bar->getFooBar()); // notice + null var_dump($bar->getBarBar()); // notice + null $rBarBar = new ReflectionProperty(Foo::class, 'bar'); $rBarBar->setAccessible(true); $rBarBar->setValue($bar, __LINE__); var_dump($bar->getFooBar()); // line no. var_dump($bar->getBarBar()); // notice + null
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pCmTV
function name:  (null)
number of ops:  36
compiled vars:  !0 = $bar, !1 = $rBarBar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $2      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   37     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getFooBar'
          5        DO_FCALL                                      0  $5      
          6        SEND_VAR                                                 $5
          7        DO_ICALL                                                 
   38     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'getBarBar'
         10        DO_FCALL                                      0  $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                                 
   40    13        NEW                                              $9      'ReflectionProperty'
         14        SEND_VAL_EX                                              'Foo'
         15        SEND_VAL_EX                                              'bar'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !1, $9
   41    18        INIT_METHOD_CALL                                         !1, 'setAccessible'
         19        SEND_VAL_EX                                              <true>
         20        DO_FCALL                                      0          
   42    21        INIT_METHOD_CALL                                         !1, 'setValue'
         22        SEND_VAR_EX                                              !0
         23        SEND_VAL_EX                                              42
         24        DO_FCALL                                      0          
   44    25        INIT_FCALL                                               'var_dump'
         26        INIT_METHOD_CALL                                         !0, 'getFooBar'
         27        DO_FCALL                                      0  $14     
         28        SEND_VAR                                                 $14
         29        DO_ICALL                                                 
   45    30        INIT_FCALL                                               'var_dump'
         31        INIT_METHOD_CALL                                         !0, 'getBarBar'
         32        DO_FCALL                                      0  $16     
         33        SEND_VAR                                                 $16
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pCmTV
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   UNSET_OBJ                                                'bar'
   10     1      > RETURN                                                   null

End of function __construct

Function getfoobar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pCmTV
function name:  getFooBar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'bar'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function getfoobar

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pCmTV
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   26     2        UNSET_OBJ                                                'bar'
   27     3      > RETURN                                                   null

End of function __construct

Function getbarbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pCmTV
function name:  getBarBar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      'bar'
          1      > RETURN                                                   ~0
   32     2*     > RETURN                                                   null

End of function getbarbar

Function getfoobar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pCmTV
function name:  getFooBar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'bar'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function getfoobar

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.88 ms | 1404 KiB | 15 Q