3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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; } protected function getA() { return self::B; } } class s extends t { const A = 2; const B = 3; function __construct() { $r = new ReflectionClass($this); var_dump($r->hasConstant('A'), self::A, $this->getA()); } } $t = new t; $s = new s;
Output for 5.3.0 - 5.5.2
Fatal error: Cannot redeclare t::getA() in /in/9dS7C on line 16
Process exited with code 255.