3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class User { public $username = 'user'; public $test; } class Test { public $here = 'here'; } $user = new User; $test = new Test; $user->test = $test; $string = 'username'; var_dump($user->$string); echo '<br>'; $string = 'test'; var_dump($user->test); echo '<br>'; $string = 'test->here'; echo $user->$string;
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/fAJ9P
function name:  (null)
number of ops:  26
compiled vars:  !0 = $user, !1 = $test, !2 = $string
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
   8     1        NOP                                                      
  12     2        NEW                                              $5      :-6
         3        DO_FCALL                                      0          
         4        ASSIGN                                                   !0, $5
  13     5        NEW                                              $8      :-4
         6        DO_FCALL                                      0          
         7        ASSIGN                                                   !1, $8
  15     8        ASSIGN_OBJ                                               !0, 'test'
         9        OP_DATA                                                  !1
  17    10        ASSIGN                                                   !2, 'username'
  18    11        INIT_FCALL                                               'var_dump'
        12        FETCH_OBJ_R                                      $13     !0, !2
        13        SEND_VAR                                                 $13
        14        DO_ICALL                                                 
  19    15        ECHO                                                     '%3Cbr%3E'
  21    16        ASSIGN                                                   !2, 'test'
  22    17        INIT_FCALL                                               'var_dump'
        18        FETCH_OBJ_R                                      $16     !0, 'test'
        19        SEND_VAR                                                 $16
        20        DO_ICALL                                                 
  23    21        ECHO                                                     '%3Cbr%3E'
  25    22        ASSIGN                                                   !2, 'test-%3Ehere'
  26    23        FETCH_OBJ_R                                      $19     !0, !2
        24        ECHO                                                     $19
        25      > RETURN                                                   1

Class User: [no user functions]
Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 7.2.0