3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface PaydayInterface { public function getAccessCode(); } trait PaydayTrait { private $accessCode; public function getAccessCode() { return $this->accessCode; } } class Payday implements PaydayInterface { use PaydayTrait; /** Mapping */ private $accessCode; public function __construct($accessCode) { $this->accessCode = $accessCode; } } $pd = new Payday("1234"); var_dump($pd->getAccessCode());
based on BONnL
Output for 7.0.0 - 7.2.0
string(4) "1234"
Output for 5.4.12 - 5.6.28
Strict Standards: Payday and PaydayTrait define the same property ($accessCode) in the composition of Payday. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in /in/EPN20 on line 29 string(4) "1234"
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/EPN20 on line 8
Process exited with code 255.