3v4l.org

run code in 300+ PHP versions simultaneously
<?php class t { const A = 1; function __construct() { $r = new ReflectionClass($this); var_dump($r->hasConstant('A')); var_dump($r->hasConstant('c')); var_dump($r->hasConstant('A'), self::A); } protected function getA { return self::A; } } class s extends t { const A = 2; function __construct() { $r = new ReflectionClass($this); var_dump($r->hasConstant('A'), self::A, $this->getA()); } } $t = new t; $s = new s;
Output for 5.4.18
Parse error: syntax error, unexpected '{', expecting '(' in /in/ngAGr on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.17
Parse error: syntax error, unexpected '{', expecting '(' in /in/O3PO4 on line 12
Process exited with code 255.

preferences:
177.54 ms | 1395 KiB | 54 Q