3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function foobar() { eval(" const FOO = self::class; var_dump(FOO); "); } } (new Test)->foobar(); // This should error, but doesn't const BAR = self::class; var_dump(BAR);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mgkej
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $0      'Test'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'foobar'
          3        DO_FCALL                                      0          
   12     4        DECLARE_CONST                                            'BAR', <const ast>
   13     5        INIT_FCALL                                               'var_dump'
          6        FETCH_CONSTANT                                   ~3      'BAR'
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class Test:
Function foobar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mgkej
function name:  foobar
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INCLUDE_OR_EVAL                                          '%0A++++++++++++const+FOO+%3D+self%3A%3Aclass%3B%0A++++++++++++var_dump%28FOO%29%3B%0A++++++++', EVAL
    8     1      > RETURN                                                   null

End of function foobar

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
127.57 ms | 1399 KiB | 15 Q