3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $p1 = "secret"; public function B() { var_dump($this); //$this = test; var_dump($this_var); ${'t' . 'his'} = 'hidden'; // works var_dump($this); var_dump($GLOBALS['this']); // class is global but $this is not since only refers to this particular object. $GLOBALS['this'] = 'lovely'; var_dump($this, $GLOBALS['this']); echo "{$GLOBALS['this']} $this {$this->p1}"; } } $a = new A; $a->B();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dk1GY
function name:  (null)
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_METHOD_CALL                                         !0, 'B'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class A:
Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dk1GY
function name:  B
number of ops:  39
compiled vars:  !0 = $this_var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_THIS                                       ~1      
          2        SEND_VAL                                                 ~1
          3        DO_ICALL                                                 
    8     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
    9     7        FETCH_W                      local               $4      'this'
          8        ASSIGN                                                   $4, 'hidden'
   10     9        INIT_FCALL                                               'var_dump'
         10        FETCH_THIS                                       ~6      
         11        SEND_VAL                                                 ~6
         12        DO_ICALL                                                 
   11    13        INIT_FCALL                                               'var_dump'
         14        FETCH_R                      global              ~8      'GLOBALS'
         15        FETCH_DIM_R                                      ~9      ~8, 'this'
         16        SEND_VAL                                                 ~9
         17        DO_ICALL                                                 
   12    18        FETCH_W                      global              $11     'GLOBALS'
         19        ASSIGN_DIM                                               $11, 'this'
         20        OP_DATA                                                  'lovely'
   13    21        INIT_FCALL                                               'var_dump'
         22        FETCH_THIS                                       ~13     
         23        SEND_VAL                                                 ~13
         24        FETCH_R                      global              ~14     'GLOBALS'
         25        FETCH_DIM_R                                      ~15     ~14, 'this'
         26        SEND_VAL                                                 ~15
         27        DO_ICALL                                                 
   14    28        FETCH_R                      global              ~17     'GLOBALS'
         29        FETCH_DIM_R                                      ~18     ~17, 'this'
         30        ROPE_INIT                                     5  ~22     ~18
         31        ROPE_ADD                                      1  ~22     ~22, '+'
         32        FETCH_THIS                                       ~19     
         33        ROPE_ADD                                      2  ~22     ~22, ~19
         34        ROPE_ADD                                      3  ~22     ~22, '+'
         35        FETCH_OBJ_R                                      ~20     'p1'
         36        ROPE_END                                      4  ~21     ~22, ~20
         37        ECHO                                                     ~21
   16    38      > RETURN                                                   null

End of function b

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.65 ms | 1404 KiB | 15 Q