3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { function __construct() { $this->a = "hello"; $this->b = "hi"; $val = "a"; echo $this->{$val}; // outputs "hello" echo "\n\n"; $val = "b"; echo $this->{$val}; // outputs "hi" } } $foo = new foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kHSgT
function name:  (null)
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
          3      > RETURN                                                   1

Class foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kHSgT
function name:  __construct
number of ops:  12
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN_OBJ                                               'a'
          1        OP_DATA                                                  'hello'
    6     2        ASSIGN_OBJ                                               'b'
          3        OP_DATA                                                  'hi'
    8     4        ASSIGN                                                   !0, 'a'
    9     5        FETCH_OBJ_R                                      ~4      !0
          6        ECHO                                                     ~4
   11     7        ECHO                                                     '%0A%0A'
   13     8        ASSIGN                                                   !0, 'b'
   14     9        FETCH_OBJ_R                                      ~6      !0
         10        ECHO                                                     ~6
   15    11      > RETURN                                                   null

End of function __construct

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.78 ms | 1385 KiB | 13 Q