3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace { const TEST_CONST1 = true; define("TEST_CONST2", true); function testExistConst() { var_dump(constant("TEST_CONST1")); var_dump(constant("TEST_CONST2")); var_dump(TEST_CONST1); var_dump(TEST_CONST2); } }
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/6rhYT
function name:  (null)
number of ops:  7
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   DECLARE_CONST                                            'TEST_CONST1', <true>
   5     1        INIT_FCALL                                               'define'
         2        SEND_VAL                                                 'TEST_CONST2'
         3        SEND_VAL                                                 <true>
         4        DO_ICALL                                                 
   7     5        NOP                                                      
  12     6      > RETURN                                                   1

Function testexistconst:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/6rhYT
function name:  testExistConst
number of ops:  21
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   8     0  E >   INIT_FCALL                                               'var_dump'
         1        INIT_FCALL                                               'constant'
         2        SEND_VAL                                                 'TEST_CONST1'
         3        DO_ICALL                                         $0      
         4        SEND_VAR                                                 $0
         5        DO_ICALL                                                 
   9     6        INIT_FCALL                                               'var_dump'
         7        INIT_FCALL                                               'constant'
         8        SEND_VAL                                                 'TEST_CONST2'
         9        DO_ICALL                                         $2      
        10        SEND_VAR                                                 $2
        11        DO_ICALL                                                 
  10    12        INIT_FCALL                                               'var_dump'
        13        FETCH_CONSTANT                                   ~4      'TEST_CONST1'
        14        SEND_VAL                                                 ~4
        15        DO_ICALL                                                 
  11    16        INIT_FCALL                                               'var_dump'
        17        FETCH_CONSTANT                                   ~6      'TEST_CONST2'
        18        SEND_VAL                                                 ~6
        19        DO_ICALL                                                 
  12    20      > RETURN                                                   null

End of function testexistconst

Generated using Vulcan Logic Dumper, using php 7.3.0