3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $x = 1; // access modifiers effect property/method visibility not scope protected $y = 2; private $z = 3; } $o = new Test(); function TryIt(){ $f = new Test(); echo $f->x; } TryIt(); var_dump($GLOBALS['o']); var_dump($GLOBALS['f']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8rN8
function name:  (null)
number of ops:  16
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   14     3        INIT_FCALL                                               'tryit'
          4        DO_FCALL                                      0          
   16     5        INIT_FCALL                                               'var_dump'
          6        FETCH_R                      global              ~5      'GLOBALS'
          7        FETCH_DIM_R                                      ~6      ~5, 'o'
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                                 
   17    10        INIT_FCALL                                               'var_dump'
         11        FETCH_R                      global              ~8      'GLOBALS'
         12        FETCH_DIM_R                                      ~9      ~8, 'f'
         13        SEND_VAL                                                 ~9
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function tryit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8rN8
function name:  TryIt
number of ops:  6
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        FETCH_OBJ_R                                      ~4      !0, 'x'
          4        ECHO                                                     ~4
   13     5      > RETURN                                                   null

End of function tryit

Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.22 ms | 1401 KiB | 17 Q