I'm always excited to take on new projects and collaborate with innovative minds.

Website

Nsour

Address

Russia, Smolensk

Social Links

Career Journey

Technical Interview Questions I Faced

Recently I went through a backend technical interview for a high-load PHP role.
Below are the questions I was asked — along with the correct structured answers.

I’m publishing this to help other developers prepare better.

1️⃣ What HTTP Methods Exist?

I initially answered:

GET, POST, PUT, PATCH, UPDATE

Correction:

There is no UPDATE method in HTTP.

✅ Common HTTP Methods:

  • GET — Retrieve data

  • POST — Create resource

  • PUT — Replace resource

  • PATCH — Partially update resource

  • DELETE — Remove resource

  • OPTIONS — Ask server what methods are allowed

  • HEAD — Same as GET but without body


🔹 What is OPTIONS Used For?

OPTIONS is commonly used in CORS preflight requests.

Before sending certain cross-origin requests (like POST with custom headers), the browser sends:

 
OPTIONS /endpoint

To check:

  • Allowed methods

  • Allowed headers

  • Allowed origin


🔹 What is CORS?

CORS (Cross-Origin Resource Sharing) is a browser security mechanism that controls whether a frontend from one domain can access resources on another domain.

Server responds with headers like:

 
Access-Control-Allow-Origin Access-Control-Allow-Methods Access-Control-Allow-Headers 

2️⃣ How Many JOINs Can Be Used If We Have 400 Tables?

This question tests database understanding.

❗ Correct Answer:

There is no practical scenario where you JOIN 400 tables.

Technically:

  • MySQL allows up to 61 tables in a JOIN.

  • PostgreSQL has high limits but performance becomes the real constraint.

But the real point:

Performance depends on indexing, join type, and execution plan — not just the number of joins.

Database engines use:

  • Nested Loop Join

  • Hash Join

  • Merge Join

Performance depends on:

  • Indexes

  • Cardinality

  • Data size

  • Query plan (EXPLAIN ANALYZE)


3️⃣ What Is Better: JOIN or Subquery?

This is likely the missing part.

Often interviewers ask:

JOIN or Subquery — which is better?

Correct answer:

It depends on the query and execution plan.

In modern databases:

  • Many subqueries are optimized into JOINs internally.

  • Performance should be evaluated using EXPLAIN ANALYZE.

General guideline:

  • JOIN is often clearer and easier to optimize.

  • EXISTS subqueries are good for existence checks.

  • Avoid correlated subqueries when possible.

Never say one is always better.


4️⃣ static vs self in PHP

This tests understanding of Late Static Binding.

Example:

class A {
    public static function dosomething() {
        echo "this do something";
    }
}

class B extends A {
    public static function dosomething() {
        echo "this is something else";
    }

    public function do() {
        self::dosomething();
        static::dosomething();
    }
}

If we call:

 
(new B())->do();

Output:

 
this do something
this is something else 

Why?

  • self:: is resolved at compile time → refers to class where method is defined.

  • static:: uses late static binding → refers to the class actually called (B).


5️⃣ What Is Database Replication?

Replication is the process of copying data from one database server (primary) to one or more replica servers.

Used for:

  • High availability

  • Read scaling

  • Disaster recovery

Types:

  • Asynchronous replication (common)

  • Synchronous replication

Important concept:

In asynchronous replication, replicas may lag behind the primary.


6️⃣ Why Didn’t PHP JIT Improve Production Performance Much?

PHP 8 introduced JIT (Just-In-Time compilation).

But in typical web applications:

  • Most time is spent in I/O:

    • Database

    • Network

    • Redis

    • File system

JIT improves CPU-heavy code.

Most web apps are I/O-bound, not CPU-bound.

Therefore:

JIT has minimal impact on typical Laravel/Yii production workloads.


7️⃣ What Changed from PHP 7 to PHP 8?

Major changes:

🚀 PHP 8 Features:

  • JIT compilation

  • Union types

  • Named arguments

  • Attributes (native annotations)

  • Match expression

  • Constructor property promotion

  • Nullsafe operator (?->)

  • Weak maps

Example:

 
$user?->profile?->name;

Much cleaner than nested checks.


Final Thoughts

Technical interviews for high-load backend roles focus heavily on:

  • Database internals

  • Query planning

  • Index tradeoffs

  • Distributed systems basics

  • Deep understanding of fundamentals

If you're targeting senior backend roles, strengthen:

  • Index theory (B-Tree)

  • Join algorithms

  • Isolation levels

  • Replication strategies

  • Query optimization


If this helped you — bookmark it.
More deep backend notes coming soon.

— nsour.ru

3 min read
Feb 18, 2026
By Wared Nsour
Share

Leave a comment

Your email address will not be published. Required fields are marked *

Your experience on this site will be improved by allowing cookies. Cookie Policy