note 116959 added to language.namespaces
| From: | davidkennedy85 at gmail dot com | Date: | Thu, 26 Mar 2015 17:04:52 +0000 |
| Subject: | note 116959 added to language.namespaces | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202049@lists.php.net to get a copy of this message | ||
In addition to using namespaces and closures, the use keyword has another new meaning as of PHP 5.4
- using traits:
<?php
trait Hello {
public function sayHello() {
echo 'Hello ';
}
}
trait World {
public function sayWorld() {
echo 'World';
}
}
class MyHelloWorld {
use Hello, World;
public function sayExclamationMark() {
echo '!';
}
}
$o = new MyHelloWorld();
$o->sayHello();
$o->sayWorld();
$o->sayExclamationMark();
?>
More info here: http://php.net/manual/en/language.oop5.traits.php
----
Server IP: 72.52.91.14
Probable Submitter: 64.127.68.170
----
Manual Page -- http://php.net/manual/en/language.namespaces.php
Edit -- https://master.php.net/note/edit/116959
Del: integrated -- https://master.php.net/note/delete/116959/integrated
Del: useless -- https://master.php.net/note/delete/116959/useless
Del: bad code -- https://master.php.net/note/delete/116959/bad+code
Del: spam -- https://master.php.net/note/delete/116959/spam
Del: non-english -- https://master.php.net/note/delete/116959/non-english
Del: in docs -- https://master.php.net/note/delete/116959/in+docs
Del: other reasons-- https://master.php.net/note/delete/116959
Reject -- https://master.php.net/note/reject/116959
Search -- https://master.php.net/manage/user-notes.php