3v4l.org

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

End of function __construct

Function setx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AcjQa
function name:  setX
number of ops:  4
compiled vars:  !0 = $valorX, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        ASSIGN_OBJ                                               !1
          2        OP_DATA                                                  !0
   29     3      > RETURN                                                   null

End of function setx

Function getx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AcjQa
function name:  getX
number of ops:  3
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~1      !0
          1      > RETURN                                                   ~1
   32     2*     > RETURN                                                   null

End of function getx

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.52 ms | 1403 KiB | 13 Q