Search code examples
phpinterface

Explicit interface implementation in php


Since I'm a C#-/.NET-guy, I'm used to explicit interface implementations - like so:

public interface IBar
{
    bool Bacon();
}

public class Foo : IBar
{
    bool IBar.Bacon() {}
}

Question:
Is this possible to do in php?

Edit:
To clarify, this is implicit (while what I want, and what is in the above example, is explicit):

public class Foo : IBar
{
    bool Bacon() {}
}

Solution

  • PHP supports interfaces, so yes it is possible: http://php.net/manual/en/language.oop5.interfaces.php

    PHP does not distinguish between implicit and explicit implementations.