3v4l.org

run code in 300+ PHP versions simultaneously
<?php function pr($a) { echo $a . PHP_EOL; } class ModuleConfig { const PAYMENT_GATEWAY_MOLLIE_KEY = 'deadbeef'; } $paymentGateway = 'MOLLIE'; $gatewayKey = 'ModuleConfig::PAYMENT_GATEWAY_' . strtoupper($paymentGateway) . '_KEY'; $foo = ModuleConfig::PAYMENT_GATEWAY_MOLLIE_KEY; pr($foo); // prints the key pr($gatewayKey); // prints ModuleConfig::PAYMENT_GATEWAY_MOLLIE_KEY pr(constant($gatewayKey)); // tells me it cannot find a constant ModuleConfig::PAYMENT_GATEWAY_MOLLIE_KEY
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ye4Vq
function name:  (null)
number of ops:  21
compiled vars:  !0 = $paymentGateway, !1 = $gatewayKey, !2 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, 'MOLLIE'
   11     1        INIT_FCALL                                               'strtoupper'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        CONCAT                                           ~5      'ModuleConfig%3A%3APAYMENT_GATEWAY_', $4
          5        CONCAT                                           ~6      ~5, '_KEY'
          6        ASSIGN                                                   !1, ~6
   13     7        ASSIGN                                                   !2, 'deadbeef'
   15     8        INIT_FCALL                                               'pr'
          9        SEND_VAR                                                 !2
         10        DO_FCALL                                      0          
   16    11        INIT_FCALL                                               'pr'
         12        SEND_VAR                                                 !1
         13        DO_FCALL                                      0          
   17    14        INIT_FCALL                                               'pr'
         15        INIT_FCALL                                               'constant'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $11     
         18        SEND_VAR                                                 $11
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

Function pr:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ye4Vq
function name:  pr
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        CONCAT                                           ~1      !0, '%0A'
          2        ECHO                                                     ~1
          3      > RETURN                                                   null

End of function pr

Class ModuleConfig: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.43 ms | 1398 KiB | 20 Q