3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait { public function getSlug() { return $this->name; } } interface Sluggable { public function getSlug(); } class MyClass implements Sluggable { protected $name; public function __construct($name) { $this->name = $name; } } var_dump((new MyClass('Kev'))->getSlug());
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected '{', expecting identifier (T_STRING) in /in/hlgpP on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '{' in /in/hlgpP on line 3
Process exited with code 255.

preferences:
178.57 ms | 1399 KiB | 61 Q