Skip to content

Instantly share code, notes, and snippets.

@jamband
Created January 12, 2013 14:51
Show Gist options
  • Save jamband/4518377 to your computer and use it in GitHub Desktop.
Save jamband/4518377 to your computer and use it in GitHub Desktop.
PHP: trait example
<?php
trait Trait1
{
public function a()
{
echo 'a1';
}
}
trait Trait2
{
public function a()
{
echo 'a2';
}
}
class Class1
{
use Trait1, Trait2 {
Trait2::a insteadof Trait1;
}
}
$c = new Class1();
$c->a();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment