3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public $public = 'Pub'; protected $protected = 'Protec'; private $private = 'Pri'; function printHello() { echo $this->public; echo $this->protected; echo $this->private; } } class MyClass2 extends MyClass { // We can redeclare the public and protected method, but not private protected $protected = 'Protected2'; function printHello() { echo $this->public; echo $this->protected; echo $this->private; } } $obj2 = new MyClass2(); //echo $obj2->public; // Works //echo $obj2->protected; // Fatal Error //echo $obj2->private; // Undefined $obj2->printHello(); // Shows Public, Protected2, Undefined ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q0OAV
function name:  (null)
number of ops:  6
compiled vars:  !0 = $obj2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $1      'MyClass2'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   35     3        INIT_METHOD_CALL                                         !0, 'printHello'
          4        DO_FCALL                                      0          
   40     5      > RETURN                                                   1

Class MyClass:
Function printhello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q0OAV
function name:  printHello
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                      ~0      'public'
          1        ECHO                                                     ~0
   13     2        FETCH_OBJ_R                                      ~1      'protected'
          3        ECHO                                                     ~1
   14     4        FETCH_OBJ_R                                      ~2      'private'
          5        ECHO                                                     ~2
   15     6      > RETURN                                                   null

End of function printhello

End of class MyClass.

Class MyClass2:
Function printhello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q0OAV
function name:  printHello
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~0      'public'
          1        ECHO                                                     ~0
   26     2        FETCH_OBJ_R                                      ~1      'protected'
          3        ECHO                                                     ~1
   27     4        FETCH_OBJ_R                                      ~2      'private'
          5        ECHO                                                     ~2
   28     6      > RETURN                                                   null

End of function printhello

End of class MyClass2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.98 ms | 1398 KiB | 14 Q