3v4l.org

run code in 300+ PHP versions simultaneously
<?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:  7
compiled vars:  !0 = $classname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'constant+value%0A'
   15     1        ASSIGN                                                   !0, 'MyClass'
   16     2        FETCH_CLASS                                   0  $2      !0
          3        FETCH_CLASS_CONSTANT                             ~3      $2, 'CONSTANT'
          4        CONCAT                                           ~4      ~3, '%0A'
          5        ECHO                                                     ~4
   23     6      > 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 8.0.0


preferences:
157.14 ms | 1393 KiB | 13 Q