Voting

: seven plus zero?
(Example: nine)

The Note You're Voting On

davidkennedy85 at gmail dot com
9 years ago
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

<< Back to user notes page

To Top