3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { const BAR = 'this is bar'; } var_dump(Foo::BAR); $str = 'BAR'; var_dump(constant(Foo::class. '::' . $str)); // var_dump(Foo::{$str}); -> これはできない
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NrfSF
function name:  (null)
number of ops:  12
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'this+is+bar'
          2        DO_ICALL                                                 
    9     3        ASSIGN                                                   !0, 'BAR'
   11     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'constant'
          6        CONCAT                                           ~3      'Foo%3A%3A', !0
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
   13    11      > RETURN                                                   1

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.21 ms | 1394 KiB | 17 Q