3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class MyClass { const CONSTANT = 'constant value'; function showConstant() { echo self::CONSTANT . "\n"; } } echo MyClass::CONSTANT . "\n"; $classname = "MyClass"; echo $classname::CONSTANT . "\n"; // As of PHP 5.3.0 /*$class = new MyClass(); $class->showConstant(); echo $class::CONSTANT."\n"; // As of PHP 5.3.0/*/ ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JGJ38
function name:  (null)
number of ops:  8
compiled vars:  !0 = $classname
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   NOP                                                      
  13     1        ECHO                                                     'constant+value%0A'
  15     2        ASSIGN                                                   !0, 'MyClass'
  16     3        FETCH_CLASS                                 512  :3      !0
         4        FETCH_CLASS_CONSTANT                             ~4      $3, 'CONSTANT'
         5        CONCAT                                           ~5      ~4, '%0A'
         6        ECHO                                                     ~5
  23     7      > RETURN                                                   1

Class MyClass:
Function showconstant:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JGJ38
function name:  showConstant
number of ops:  2
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   9     0  E >   ECHO                                                     'constant+value%0A'
  10     1      > RETURN                                                   null

End of function showconstant

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 7.3.0