3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php interface ContactFieldsInterface { public function getEmail(); } trait ContactFieldsTrait { protected $email; public function getEmail() { return $this->email; } } class User { protected $email; } class Contact extends User implements ContactFieldsInterface { use ContactFieldsTrait { User::email insteadof ContactFieldsTrait; } }
Output for 7.0.0 - 7.1.0
Fatal error: Class User is not a trait, Only traits may be used in 'as' and 'insteadof' statements in /in/s5NUd on line 23
Process exited with code 255.
Output for 5.4.13 - 5.6.28
Fatal error: Class User is not a trait, Only traits may be used in 'as' and 'insteadof' statements in /in/s5NUd on line 30
Process exited with code 255.
Output for 5.4.11 - 5.4.12
Fatal error: Trait User is not used in /in/s5NUd on line 30
Process exited with code 255.
Output for 5.4.0 - 5.4.10
Fatal error: A precedence rule was defined for User::email but this method does not exist in /in/s5NUd on line 30
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/s5NUd on line 7
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING in /in/s5NUd on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/s5NUd on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/s5NUd on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/s5NUd on line 3
Process exited with code 255.