3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public function setConfigParam( $sName, $sValue ) { if ( isset( $this->$sName ) ) { $this->$sName = $sValue; } else { $this->_aConfigParams[$sName] = $sValue; } } 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"}; $this->setConfigParam('aVariableName', array('one', 'two', 'three')); echo $this->$aVariableName; } } $foo = new foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HlmPW
function name:  (null)
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   NEW                                              $1      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
          3      > RETURN                                                   1

Class foo:
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/HlmPW
function name:  setConfigParam
number of ops:  11
compiled vars:  !0 = $sName, !1 = $sValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        ISSET_ISEMPTY_PROP_OBJ                                   !0
          3      > JMPZ                                                     ~2, ->7
    7     4    >   ASSIGN_OBJ                                               !0
          5        OP_DATA                                                  !1
          6      > JMP                                                      ->10
    9     7    >   FETCH_OBJ_W                                      $4      '_aConfigParams'
          8        ASSIGN_DIM                                               $4, !0
          9        OP_DATA                                                  !1
   11    10    > > RETURN                                                   null

End of function setconfigparam

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HlmPW
function name:  __construct
number of ops:  26
compiled vars:  !0 = $val, !1 = $aVariableName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN_OBJ                                               'a'
          1        OP_DATA                                                  'hello'
   16     2        ASSIGN_OBJ                                               'b'
          3        OP_DATA                                                  'hi'
   17     4        ASSIGN_OBJ                                               'val'
          5        OP_DATA                                                  'howdy'
   19     6        ASSIGN                                                   !0, 'a'
   20     7        FETCH_OBJ_R                                      ~6      !0
          8        ECHO                                                     ~6
   22     9        ECHO                                                     '%0A'
   24    10        ASSIGN                                                   !0, 'b'
   25    11        FETCH_OBJ_R                                      ~8      !0
         12        ECHO                                                     ~8
   27    13        ECHO                                                     '%0A'
   28    14        FETCH_OBJ_R                                      ~9      'val'
         15        ECHO                                                     ~9
   30    16        ECHO                                                     '%0A'
   31    17        FETCH_OBJ_R                                      ~10     'val'
         18        ECHO                                                     ~10
   33    19        INIT_METHOD_CALL                                         'setConfigParam'
         20        SEND_VAL_EX                                              'aVariableName'
         21        SEND_VAL_EX                                              <array>
         22        DO_FCALL                                      0          
   35    23        FETCH_OBJ_R                                      ~12     !1
         24        ECHO                                                     ~12
   36    25      > RETURN                                                   null

End of function __construct

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.98 ms | 1399 KiB | 13 Q