3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { const OMG = 10; public function get($what) { return constant("self::" . $what); } } class Test2 { private $test; public function __construct(Test $test) { $this->test = $test; } public function testFunc() { var_dump($this->test::OMG); } } $test = new Test(); $test2 = new Test2($test); var_dump($test2->testFunc());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2c5MR
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test, !1 = $test2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   26     3        NEW                                              $5      'Test2'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   28     7        INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !1, 'testFunc'
          9        DO_FCALL                                      0  $8      
         10        SEND_VAR                                                 $8
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Class Test:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2c5MR
function name:  get
number of ops:  7
compiled vars:  !0 = $what
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'constant'
          2        CONCAT                                           ~1      'self%3A%3A', !0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
    8     6*     > RETURN                                                   null

End of function get

End of class Test.

Class Test2:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2c5MR
function name:  __construct
number of ops:  4
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'test'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function __construct

Function testfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2c5MR
function name:  testFunc
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_OBJ_R                                      ~0      'test'
          2        FETCH_CLASS                                   0  $1      ~0
          3        FETCH_CLASS_CONSTANT                             ~2      $1, 'OMG'
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
   22     6      > RETURN                                                   null

End of function testfunc

End of class Test2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.14 ms | 1400 KiB | 17 Q