Skip to content

Instantly share code, notes, and snippets.

@amacgregor
Created March 15, 2014 20:03
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/9573105 to your computer and use it in GitHub Desktop.
Save amacgregor/9573105 to your computer and use it in GitHub Desktop.
Using traits for multiple inheritance in php
<?php
class Animal {
public function roar() {
echo "Makes animal sounds";
}
}
trait Cat {
public function roar() {
echo "Meowww";
}
}
class Tiger extends Animal {
use Cat;
}
$tiger = new Tiger;
$tiger->roar();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment