<?php
class Base {
public function sayHello() {
echo 'Experts';
}
}
trait SayWorld {
public function sayHello() {
parent::sayHello();
echo 'PHP';
}
}
class MyHelloWorld extends Base {
use SayWorld;
}
$e = new MyHelloWorld();
$e->sayHello();
?>How to use Trait in Interface PHP?
Today I will tell you how you can use trait in interface php? First of all, you create an php file, add codes. Then run codes on the server show results.
Example
31
Views