3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Ref; trait T { public $traitProperty; public function traitMethod() {} } interface I { const I = 'I'; } class A implements I { use T { T::traitMethod as tMethod; } const A = 'A'; public function __construct() {} public function a(); } 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'));
Output for 5.4.0 - 5.4.19
Fatal error: Non-abstract method Ref\A::a() must contain body in /in/p3tqY on line 27
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/p3tqY on line 5
Process exited with code 255.

preferences:
179.24 ms | 1395 KiB | 55 Q