Skip to content

Instantly share code, notes, and snippets.

@fzaninotto
Created December 20, 2011 19:31
Show Gist options
  • Save fzaninotto/1502867 to your computer and use it in GitHub Desktop.
Save fzaninotto/1502867 to your computer and use it in GitHub Desktop.
Catch Interface
<?php
interface Bar {}
class Foo extends Exception implements Bar {}
try
{
throw new Foo();
} catch (Bar $e) {
echo "good!\n";
}
@katanacrimson
Copy link

Wonder if you can do this with Traits in PHP 5.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment