I have a little question.
I would like to know how to check if an object is compliant with an interface.
I know that if the Class implements explicitly the Interface, like this:
Expand|Select|Wrap|Line Numbers
- Class RobertNestaMarley implements Smoker_Interface
Expand|Select|Wrap|Line Numbers
- $bobMarley = new RobertNestaMarley()
- if ($bobMarley instanceof Smoker_Interface) {
- echo 'Bob likes to smoke';
- }
so my only goal is to know if $bobmarley has some methods i need from it.
Lets say my interface is like this:
Expand|Select|Wrap|Line Numbers
- Interface Smoker_Interface
- {
- public function lightACigar($brand);
- }
Expand|Select|Wrap|Line Numbers
- $bobMarley->lightACigar('Cohiba');
Do you know how to do this?
Regards
Bilibytes