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"}; $this->setX(5); echo "\n"; echo $this->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/cIo5J
function name:  (null)
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     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/cIo5J
function name:  __construct
number of ops:  27
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_METHOD_CALL                                         'setX'
         20        SEND_VAL_EX                                              5
         21        DO_FCALL                                      0          
   25    22        ECHO                                                     '%0A'
   26    23        INIT_METHOD_CALL                                         'getX'
         24        DO_FCALL                                      0  $11     
         25        ECHO                                                     $11
   27    26      > 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/cIo5J
function name:  setX
number of ops:  4
compiled vars:  !0 = $valorX
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   29     1        ASSIGN_OBJ                                               'x'
          2        OP_DATA                                                  !0
   30     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/cIo5J
function name:  getX
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   FETCH_OBJ_R                                      ~0      'x'
          1      > RETURN                                                   ~0
   33     2*     > RETURN                                                   null

End of function getx

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.03 ms | 1403 KiB | 13 Q