3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait FooBarTrait { /** * @var string */ private $value; /** * {@inheritdoc} */ public function setValue(string $value): void { $this->value = $value; } /** * {@inheritdoc} */ public function getValue(): string { return $this->value; } } interface Bar { /** * @param string $value */ public function setValue(string $value): void; /** * @return string */ public function getValue(): string; } class Foo implements Bar { use FooBarTrait; } $foobar = new Foo(); $foobar->setValue('bob'); echo $foobar->getValue();
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
bob

preferences:
170.44 ms | 403 KiB | 188 Q