3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { const X = 1 + self::Z; const Y = 1 - self::Z; const Z = self::Z; function f() { echo static::X; echo static::Y; echo static::Z; } } class B extends A { const Z = 1; } (new B)->f();
Output for 7.0.0 - 7.3.0beta1
Fatal error: Uncaught Error: Cannot declare self-referencing constant 'self::Z' in /in/5aYB5:19 Stack trace: #0 {main} thrown in /in/5aYB5 on line 19
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught Error: Cannot declare self-referencing constant 'A::Z' in /in/5aYB5:-1 Stack trace: #0 /in/5aYB5(-1): A->f() #1 {main}
Process exited with code 255.
Output for hhvm-3.21.3
Fatal error: Uncaught Error: Cannot declare self-referencing constant 'A::Z' in /in/5aYB5:6 Stack trace: #0 /in/5aYB5(19): A->f() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5

Process exited with code 137.
Output for 5.6.0 - 5.6.30
201