3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Ref; trait T { const T = 't'; public $traitProperty; public function traitMethod() {} } interface I { const I = 'I'; public function i(); } abstract class A implements I { use T { T::traitMethod as tMethod; } const A = 'A'; public function __construct() {} public function a() {} } abstract class B extends A { const B = 'B'; public $public = 'public'; protected static $publicStatic; } $r = new \ReflectionClass('Ref\B'); //$r->getProperty('publicStatic')->setAccessible(true); var_dump($r->hasMethod('tMethod')); var_dump($r->hasMethod('traitMethod')); var_dump($r->hasMethod('a')); var_dump($r->hasConstant('T'));
Output for 5.4.0 - 5.4.19
Fatal error: Traits cannot have constants in /in/jDMCP on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/jDMCP on line 5
Process exited with code 255.

preferences:
177.7 ms | 1390 KiB | 56 Q