- Output for 7.1.26 - 7.1.33, 7.2.17 - 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.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
- World Hello World Hello
<?php
trait Hello {
public function getHello(){
return 'Hello';
}
public function sayHelloWorld1() {
echo "{$this->getWorld()} {$this->getHello()}\n";
}
abstract public function getWorld();
}
trait World {
public function getWorld(){
return 'World';
}
public function sayHelloWorld2() {
echo "{$this->getWorld()} {$this->getHello()}\n";
}
abstract public function getHello();
}
class MyHelloWorld {
use Hello, World;
public function __construct()
{
$this->sayHelloWorld1();
$this->sayHelloWorld2();
}
}
new MyHelloWorld;