Senior Backend Interview: OOP and PHP — Answers to Have on the Tip of Your Tongue
Public, protected, private, abstract vs interface, SOLID and dependency injection — short answers for a technical interview, no hesitation.

A senior backend interview is rarely a test of knowledge — it is a test of how quickly you can put it into words. These are the answers I have used in practice for years, boiled down to sentences you can say in fifteen seconds.
Public, protected and private
public is accessible from anywhere. protected inside the class and in classes that extend it. private only inside the class that declares it — not even a subclass can see it.
Public is open to everyone. Protected to the class and its descendants. Private only to that class — a subclass can't see it. In practice: private is the default, protected when I know the class will be extended, public only for what is genuinely the public interface.
When protected instead of private?
When I build a base class that someone will extend and I want the child to have access. Otherwise I go with private — it is easier to loosen later than to tighten.
The catch: private across instances
A private member is accessible across different instances of the same class. $this->secret and $otherObject->secret both work as long as both objects are of the same class.
Abstract class vs interface
An interface is a contract — method signatures only, and a class can implement many of them. An abstract class is a partial implementation — it can hold state and concrete methods, but you can extend only one. Interface when I define what can be done, abstract class when I share how it is done.
What final means
It prevents a class from being extended or a method from being overridden. I use it when I don't want anyone changing behaviour I rely on.
static — when yes, when no
static belongs to the class, not to an instance. Useful for factories and stateless helpers. I avoid it for logic because it can't be swapped out in a test — static is hidden global state.
Traits
A way to share implementation without inheritance — PHP has no multiple inheritance, and traits partly cover that. I use them sparingly because they hide where a method comes from.
== vs ===
Double equals compares values with type juggling, triple compares both value and type. I always use triple unless I specifically need the conversion.
Dependency injection
Instead of a class creating what it needs, it receives it from the outside. Dependencies become visible in the constructor and can be replaced in a test. The opposite is new inside a method — then you can't test without a real database.
public function __construct(private readonly OrderRepository $orders) {}
SOLID in one sentence per letter
- S — one class, one reason to change.
- O — open for extension, closed for modification.
- L — a subclass must be able to replace its parent without breaking anything.
- I — many small interfaces instead of one large one.
- D — depend on abstractions, not on concrete implementations.
If they ask which letter I use most: S and D. One responsibility per class and dependencies through interfaces — those two have the biggest impact on how testable and changeable the code is later.