3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); namespace { class Foo { const TEST = 'global'; } } namespace ClassConstFetchDefined { class Foo { const TEST = 'namspaced'; } class HelloWorld { public static function doFoo() { if (defined('Foo::TEST')) { echo \Foo::TEST . PHP_EOL; } else { echo 'not defined' . PHP_EOL; } if (defined('\Foo::TEST')) { echo \Foo::TEST . PHP_EOL; } else { echo 'not defined' . PHP_EOL; } if (defined('ClassConstFetchDefined\Foo::TEST')) { echo Foo::TEST . PHP_EOL;; } else { echo 'not defined' . PHP_EOL; } if (defined('\ClassConstFetchDefined\Foo::TEST')) { echo Foo::TEST . PHP_EOL; } else { echo 'not defined' . PHP_EOL; } } } (new HelloWorld)->doFoo(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ueJTH
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   NEW                                              $0      'ClassConstFetchDefined%5CHelloWorld'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'doFoo'
          3        DO_FCALL                                      0          
   48     4      > RETURN                                                   1

Class Foo: [no user functions]
Class ClassConstFetchDefined\Foo: [no user functions]
Class ClassConstFetchDefined\HelloWorld:
Function dofoo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
Branch analysis from position: 41
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
Branch analysis from position: 30
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
Branch analysis from position: 19
filename:       /in/ueJTH
function name:  doFoo
number of ops:  45
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_NS_FCALL_BY_NAME                                    'ClassConstFetchDefined%5Cdefined'
          1        SEND_VAL_EX                                              'Foo%3A%3ATEST'
          2        DO_FCALL                                      0  $0      
          3      > JMPZ                                                     $0, ->8
   22     4    >   FETCH_CONSTANT                                   ~1      'ClassConstFetchDefined%5CPHP_EOL'
          5        CONCAT                                           ~2      'global', ~1
          6        ECHO                                                     ~2
   21     7      > JMP                                                      ->11
   24     8    >   FETCH_CONSTANT                                   ~3      'ClassConstFetchDefined%5CPHP_EOL'
          9        CONCAT                                           ~4      'not+defined', ~3
         10        ECHO                                                     ~4
   27    11    >   INIT_NS_FCALL_BY_NAME                                    'ClassConstFetchDefined%5Cdefined'
         12        SEND_VAL_EX                                              '%5CFoo%3A%3ATEST'
         13        DO_FCALL                                      0  $5      
         14      > JMPZ                                                     $5, ->19
   28    15    >   FETCH_CONSTANT                                   ~6      'ClassConstFetchDefined%5CPHP_EOL'
         16        CONCAT                                           ~7      'global', ~6
         17        ECHO                                                     ~7
   27    18      > JMP                                                      ->22
   30    19    >   FETCH_CONSTANT                                   ~8      'ClassConstFetchDefined%5CPHP_EOL'
         20        CONCAT                                           ~9      'not+defined', ~8
         21        ECHO                                                     ~9
   33    22    >   INIT_NS_FCALL_BY_NAME                                    'ClassConstFetchDefined%5Cdefined'
         23        SEND_VAL_EX                                              'ClassConstFetchDefined%5CFoo%3A%3ATEST'
         24        DO_FCALL                                      0  $10     
         25      > JMPZ                                                     $10, ->30
   34    26    >   FETCH_CONSTANT                                   ~11     'ClassConstFetchDefined%5CPHP_EOL'
         27        CONCAT                                           ~12     'namspaced', ~11
         28        ECHO                                                     ~12
   33    29      > JMP                                                      ->33
   36    30    >   FETCH_CONSTANT                                   ~13     'ClassConstFetchDefined%5CPHP_EOL'
         31        CONCAT                                           ~14     'not+defined', ~13
         32        ECHO                                                     ~14
   39    33    >   INIT_NS_FCALL_BY_NAME                                    'ClassConstFetchDefined%5Cdefined'
         34        SEND_VAL_EX                                              '%5CClassConstFetchDefined%5CFoo%3A%3ATEST'
         35        DO_FCALL                                      0  $15     
         36      > JMPZ                                                     $15, ->41
   40    37    >   FETCH_CONSTANT                                   ~16     'ClassConstFetchDefined%5CPHP_EOL'
         38        CONCAT                                           ~17     'namspaced', ~16
         39        ECHO                                                     ~17
   39    40      > JMP                                                      ->44
   42    41    >   FETCH_CONSTANT                                   ~18     'ClassConstFetchDefined%5CPHP_EOL'
         42        CONCAT                                           ~19     'not+defined', ~18
         43        ECHO                                                     ~19
   44    44    > > RETURN                                                   null

End of function dofoo

End of class ClassConstFetchDefined\HelloWorld.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.47 ms | 1002 KiB | 14 Q