mirror of
https://github.com/php/php-src.git
synced 2024-10-16 22:12:33 +00:00
b501570ab0
#Getting accustomed to the infrastructure. #Any comments are welcome, especially with regard to syntax and keywords.
28 lines
405 B
PHP
28 lines
405 B
PHP
--TEST--
|
|
parent:: works like in a method defined without traits.
|
|
--FILE--
|
|
<?php
|
|
error_reporting(E_ALL);
|
|
|
|
class Base {
|
|
public function sayHello() {
|
|
echo 'Hello ';
|
|
}
|
|
}
|
|
|
|
trait SayWorld {
|
|
public function sayHello() {
|
|
parent::sayHello();
|
|
echo 'World!';
|
|
}
|
|
}
|
|
|
|
class MyHelloWorld extends Base {
|
|
use SayWorld;
|
|
}
|
|
|
|
$o = new MyHelloWorld();
|
|
$o->sayHello();
|
|
?>
|
|
--EXPECTF--
|
|
Hello World!
|