3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { const PK = "B"; public function __construct() { $this->self = $this; } public function c() { $this->self::B; } } $a = new A; $a->c();
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Undefined class constant 'B' in /in/n41iv:14 Stack trace: #0 /in/n41iv(19): A->c() #1 {main} thrown in /in/n41iv on line 14
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) in /in/n41iv on line 14
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /in/n41iv on line 14
Process exited with code 255.