Skip to content

Instantly share code, notes, and snippets.

@amacgregor
Created March 15, 2014 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amacgregor/9573275 to your computer and use it in GitHub Desktop.
Save amacgregor/9573275 to your computer and use it in GitHub Desktop.
Multiple Traits
<?php
class Animal {
public function roar() {
echo "Makes animal sounds";
}
}
trait Cat {
public function roar() {
echo "Meowww";
}
}
trait BigCat {
public function kill() {
echo "Kill an animal";
}
}
class Tiger extends Animal {
use Cat;
use BigCat;
}
$tiger = new Tiger;
$tiger->roar();
$tiger->kill();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment