3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { function __construct() { $this->a = "hello"; $this->b = "hi"; $this->val = "howdy"; $val = "a"; echo $this->{$val}; // outputs "hello" echo "\n"; $val = "b"; echo $this->{$val}; // outputs "hi" echo "\n"; echo $this->val; //outputs "howdy" echo "\n"; echo $this->{"val"}; setConfigParam('aVariableName', array('one', 'two', 'three')); echo $this->$aVariableName; } public function setConfigParam( $sName, $sValue ) { if ( isset( $this->$sName ) ) { $this->$sName = $sValue; } else { $this->_aConfigParams[$sName] = $sValue; } } } $foo = new foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R2FKt
function name:  (null)
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     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/R2FKt
function name:  __construct
number of ops:  26
compiled vars:  !0 = $val, !1 = $aVariableName
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'
    7     4        ASSIGN_OBJ                                               'val'
          5        OP_DATA                                                  'howdy'
    9     6        ASSIGN                                                   !0, 'a'
   10     7        FETCH_OBJ_R                                      ~6      !0
          8        ECHO                                                     ~6
   12     9        ECHO                                                     '%0A'
   14    10        ASSIGN                                                   !0, 'b'
   15    11        FETCH_OBJ_R                                      ~8      !0
         12        ECHO                                                     ~8
   17    13        ECHO                                                     '%0A'
   18    14        FETCH_OBJ_R                                      ~9      'val'
         15        ECHO                                                     ~9
   20    16        ECHO                                                     '%0A'
   21    17        FETCH_OBJ_R                                      ~10     'val'
         18        ECHO                                                     ~10
   23    19        INIT_FCALL_BY_NAME                                       'setConfigParam'
         20        SEND_VAL_EX                                              'aVariableName'
         21        SEND_VAL_EX                                              <array>
         22        DO_FCALL                                      0          
   25    23        FETCH_OBJ_R                                      ~12     !1
         24        ECHO                                                     ~12
   26    25      > RETURN                                                   null

End of function __construct

Function setconfigparam:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R2FKt
function name:  setConfigParam
number of ops:  11
compiled vars:  !0 = $sName, !1 = $sValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   32     2        ISSET_ISEMPTY_PROP_OBJ                                   !0
          3      > JMPZ                                                     ~2, ->7
   33     4    >   ASSIGN_OBJ                                               !0
          5        OP_DATA                                                  !1
          6      > JMP                                                      ->10
   35     7    >   FETCH_OBJ_W                                      $4      '_aConfigParams'
          8        ASSIGN_DIM                                               $4, !0
          9        OP_DATA                                                  !1
   37    10    > > RETURN                                                   null

End of function setconfigparam

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.22 ms | 1399 KiB | 13 Q