xref: /PHP-8.0/Zend/tests/traits/language002.phpt (revision d679f022)
1--TEST--
2Use multiple traits.
3--FILE--
4<?php
5error_reporting(E_ALL);
6
7trait Hello {
8   public function sayHello() {
9     echo 'Hello ';
10   }
11}
12
13trait World {
14   public function sayWorld() {
15     echo 'World';
16   }
17}
18
19class MyHelloWorld {
20   use Hello, World;
21   public function sayExclamationMark() {
22     echo '!';
23   }
24}
25
26$o = new MyHelloWorld();
27$o->sayHello();
28$o->sayWorld();
29$o->sayExclamationMark();
30?>
31--EXPECT--
32Hello World!
33