3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface fooAPI{ public function doFoo(); } trait fooable{ protected $foo; public function __construct( $foo ){ $this->_foo = $foo; } public function doFoo(){ return $this->_foo; } } class Foo{ use fooable{ fooable::__construct as _fooable__construct; _fooable__construct as protected; } public function __construct(){ $this->_fooable__construct( "foo" ); } } echo (new Foo)->doFoo();
based on A8NAm
Output for 7.0.0 - 7.2.0
Fatal error: The modifiers for the trait alias _fooable__construct() need to be changed in the same statement in which the alias is defined. Error in /in/YllN2 on line 13
Process exited with code 255.
Output for 5.4.8 - 5.6.28
Fatal error: The modifiers for the trait alias _fooable__construct() need to be changed in the same statment in which the alias is defined. Error in /in/YllN2 on line 21
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/YllN2 on line 7
Process exited with code 255.