Back to Blog

PHP Developer Interview Questions 2026

HiringIT HiringSoftware Development

Last updated: November 28, 2026

By Mike Carter, Managing Director, KORE1

Good PHP developer interview questions in 2026 are short code reviews of snippets that run cleanly and still refund a stranger, lose a cent, or spend a gift card twice. Syntax trivia gets ten minutes.

Send a refund webhook the word true where the signature belongs. If the code on the other end compares with two equals signs, the money goes out. No secret needed. No error is thrown, no warning is logged, and nothing in the access log looks odd the next morning, because as far as the server is concerned a valid request arrived and was handled exactly the way the code asked, on PHP 8.6 as much as on anything older.

That’s the first exercise. Five more like it follow, each short enough to print on a single sheet, and after them come an upgrade ticket with real end-of-support dates on it and a replacement exercise for teams that are hiring into WordPress or WooCommerce.

I’m a managing director at a staffing firm, not a PHP developer, so nothing here rests on my taste in code. The six pull requests and the upgrade snippet were run on PHP 8.3, 8.4, 8.5, and 8.6 before they were printed, and the results described are what came back. The WordPress one was checked against WordPress’s documentation and source instead. The shops and sums are made up. Our PHP developer staffing team earns a fee when you hire someone we introduce, so discount my advice by whatever that’s worth to you.

Open brass padlock on a gate hasp, a picture of a PHP webhook check that lets a forged signature through

Why Review Code Instead of Asking for Definitions

A PHP developer interview should test whether someone can read server-side code and predict what it does with hostile input, real money, two requests at once, and a newer runtime. Reciting definitions shows much less. Reading other people’s changes is a daily part of the job, and review is where a mistake gets stopped or shipped.

Definitions are cheap now. Anyone can rehearse the difference between an interface and an abstract class on the train. A diff is harder to rehearse, since the candidate has never seen it before, can’t know which line you care about, and will often find that the most useful thing to say about it is a question back to you about how the business wants it to behave.

Our guide to hiring PHP developers already carries a handful of spoken questions on project structure, a slow endpoint, eager loading, legacy refactoring, and a leaked database password. Keep those. What follows sits beside them and goes on paper. Two other jobs come before the interview, naming the seat with our PHP developer job description template and pricing it with the PHP developer salary guide.

A Short Verbal Screen Comes First

Ten minutes. No whiteboard. All you’re doing here is making sure the person has spent real time with PHP before you hand them code, so resist the urge to rank anybody on it, however confidently the first three answers come out.

AskListen forWorry if you hear
What does "1e3" == "1000" return?True. Both are numeric strings, so they’re compared as numbers. IDs and codes get ===“False, they’re different strings”
Under PHP-FPM, what happens to a static property between two web requests?It’s gone. Then, unprompted, “unless this code also runs in a worker”“It stays in memory until the server restarts”
composer install or composer update on a deploy?Install, from the lock file, so production gets what was testedUpdate, “to stay current”
You loop an array by reference, then loop it again by value. Any problem?The reference survives the first loop, so [1,2,3] ends up as [1,2,2]. Call unset()A blank look, then “no”
What PHP version does your current production run?A number, and roughly when its security fixes stop“The hosting handles that”

Six Pull Requests to Put on the Table

Give the candidate the title and the code. Say the tests are green. Then ask one thing, which is whether they’d approve it, and wait longer than feels comfortable, because the people who need ninety seconds of quiet to trace a value through six lines are often the same people you’d want tracing it in production.

PR 1. The Refund Webhook

Title on the pull request, “Verify signatures on refund webhooks.” Honestly an improvement. Before this change the endpoint refunded whoever asked.

// POST /webhooks/refunds
$payload  = json_decode(file_get_contents('php://input'), true);
$signed   = $payload['order_id'] . '|' . $payload['amount'];
$expected = hash_hmac('sha256', $signed, $secret);

if ($payload['signature'] == $expected) {
    $refunds->issue($payload['order_id'], $payload['amount']);
    http_response_code(200);
} else {
    http_response_code(401);
}

The trouble is that json_decode keeps types, so whoever sends the request picks the type of signature. Send {"order_id":8812,"amount":4999,"signature":true} and the refund is issued. PHP’s comparison rules say that when either side is a bool, both sides are converted to bool. A non-empty hash string converts to true. True equals true.

A strong review blocks the merge and asks for four things. Reject anything that isn’t a string. Compare with hash_equals(), which takes the same time whether the first character or the last one is wrong, and which throws a TypeError if handed a bool. Sign the raw request body, not two fields glued back together. Record an event ID or timestamp so a captured request can’t be replayed into a second refund.

“Change it to three equals signs.” Half marks. That shuts the bool hole and leaves the timing and replay problems standing.

One footnote worth asking a senior about. On PHP 7 a signature of 0 also matched any hash that began with a letter. PHP 8 changed how numbers compare with strings and closed that one. It did not touch the bool rule. Hiring for a security-heavy seat? Pair this with a round from our application security interview questions.

PR 2. Prices Into Cents

“Send integer cents to the payment processor.” Sensible title. Eight lines.

function toCents(string $amount): int
{
    return (int) ($amount * 100);
}

// The tests that shipped with it
assert(toCents('10.00') === 1000);
assert(toCents('25.50') === 2550);

Both tests pass. Of course they do.

Now call toCents('19.99'). You get 1998. The string is turned into a binary floating-point number that can’t hold 19.99 exactly, the multiplication lands a hair under 1999 because of that, and the (int) cast then chops off everything after the point without rounding, which costs somebody a penny and leaves no trace. PHP’s own manual warns that floating-point numbers have limited precision. We ran every price from $0.01 to $100.00 through this function. 573 of the 10,000 came back one cent short, including $0.29, $4.35, and $19.99. The two values in the tests were among the lucky ones.

Ask for a test that fails today. A candidate who offers 19.99 or 0.29 without hunting has been bitten before.

On the fix, wrapping the product in round() corrected all 573 in that range, so it’s a fair patch for this afternoon. The better answer keeps money out of floats altogether, either by storing integer cents from the moment an amount enters the system and converting only when it has to be shown to a person, or by doing the arithmetic through BCMath, where bcmul('19.99', '100', 0) returns 1999. PHP 8.4 added a BcMath\Number object for the same work. Plenty of teams use a money library. Any of those is fine. “Floats are close enough” is not.

Four stacks of copper discs with one stack short by a disc, a picture of a PHP float cast losing a cent

PR 3. Sortable Order History

Customers asked to sort their orders by total. The developer knew better than to paste user input into SQL, and wrote this.

$sort = $_GET['sort'] ?? 'created_at';

$stmt = $pdo->prepare(
    'SELECT id, total, created_at FROM orders
     WHERE customer_id = :cid ORDER BY :sort DESC'
);
$stmt->execute(['cid' => $customerId, 'sort' => $sort]);

It looks safe. It is safe. It also doesn’t sort anything.

A placeholder stands for a value and nothing else. The PDO documentation says parameter markers can’t bind an identifier or a keyword. So the database receives an instruction to order every row by the string 'total' rather than by the column of that name, and since that string is identical for all of them, every row ties with every other row and they come back in whatever order suits the database. We ran it on SQLite and on MySQL 8.4. Asking for total and asking for created_at returned the rows in the same order. No error either time. If the test rows happen to be inserted in the order the assertion expects, the suite stays green for months.

The answer to hope for is an allowlist.

$column = match ($_GET['sort'] ?? '') {
    'total' => 'total',
    default => 'created_at',
};
// $column can only ever be one of those two strings
$sql = "SELECT id, total, created_at FROM orders
        WHERE customer_id = :cid ORDER BY $column DESC";

The answer to fear is “just drop $sort into the string.” That trades a harmless bug for SQL injection. Some candidates suggest quote() instead, which turns the column name back into a string literal and puts you exactly where you started. Follow up by asking how they’d have caught it. Seed three orders so that insertion order, date order, and total order all disagree, then assert on each.

PR 4. Monthly Renewals

Subscriptions need the next billing period. The example date is the last day of January 2027.

function renew(DateTime $paidThrough): array
{
    $periodStart = $paidThrough;
    $periodEnd   = $paidThrough->modify('+1 month');

    return [$periodStart->format('M j'), $periodEnd->format('M j')];
}

renew(new DateTime('2027-01-31'));

What comes back? ["Mar 3","Mar 3"].

Two separate bugs, stacked. DateTime::modify() changes the object it’s called on and hands the same object back, so $periodStart and $periodEnd are one date wearing two names. And adding a month to January 31 gives February 31, which PHP rolls forward into March 3.

Most candidates who’ve worked with PHP dates say DateTimeImmutable within the first minute, often with a small wince that suggests they learned it from a bug report with their own name on it. Good. That cures the first bug and does nothing for the second. The ones worth keeping stop and ask which day a customer who signed up on the 31st expects to be billed. That’s a product decision, not a language feature. If the rule is “the 31st, or the month’s last day when there’s no 31st,” the next three dates run February 28, March 31, and April 30, and each one has to be calculated from the original signup date, never from whatever date happened to be billed last. Chain +1 month from the previous bill instead and you get March 3, then April 3, and that customer is a 3rd-of-the-month customer forever.

Someone will suggest last day of next month. Ask what it does to a person who signed up on January 15. It bills them February 28.

PR 5. A Faster Tax Lookup

The lookup was hitting the database on every line item. The pull request cut it to one query.

final class TaxRates
{
    private static ?float $rate = null;

    public static function for(Store $store): float
    {
        return self::$rate ??= $store->lookupRate();
    }
}

On a classic PHP-FPM site this is fine, because the static property dies with the request. Then somebody moves invoice generation onto queue:work to make the checkout page faster, or puts the whole application on Octane or FrankenPHP’s worker mode for the same reason, and the process that used to forget everything at the end of each request now remembers it for hours.

Picture two jobs in one worker. A Sacramento store goes first, with a made-up rate of 8.75 percent. A Portland store goes second, in a state with no general sales tax. Portland’s $200 order gets $17.50 in tax. We ran exactly that, in one process, and that’s what printed.

Laravel’s queue documentation is blunt about it, warning that static state created or modified by your application “will not be automatically reset between jobs.” The Octane documentation raises the same concern for web requests. A good candidate either keys the cache by store ID, so that one store’s rate can never answer for another, or moves it off the class and onto an object whose lifetime the framework controls, such as one registered with a scoped binding. A scoped binding won’t rescue a static property, though. Listen for whether they know the difference.

“We restart the workers every night.” That’s a schedule for being wrong all day.

PR 6. Gift Card Checkout

This one looks careful. It even has a transaction.

$pdo->beginTransaction();

$q = $pdo->prepare('SELECT balance FROM gift_cards WHERE code = ?');
$q->execute([$code]);
$balance = (int) $q->fetchColumn();

if ($balance >= $amount) {
    $pdo->prepare('UPDATE gift_cards SET balance = ? WHERE code = ?')
        ->execute([$balance - $amount, $code]);
    $orders->markPaid($orderId, $amount);
}

$pdo->commit();

A card holds $100. Two checkouts for $80 arrive together, say from a double-clicked button or a shared card number. Both read 10000 cents. Both pass the check. Both write 2000. The shop has handed over $160 in goods and the card still shows $20. We reproduced it on MySQL 8.4 at its default isolation level, with both requests inside transactions.

The transaction doesn’t help, because an ordinary SELECT inside it reads a snapshot of the row and takes no lock on it, which leaves the second request free to read the same $100 balance while the first one is still deciding what to do with it. MySQL’s page on locking reads says a regular select “does not give enough protection” when you query data and then update related data. Two fixes work. Add FOR UPDATE to the read, so the second request waits its turn. Or let the database do the check and the subtraction in one statement.

$q = $pdo->prepare('UPDATE gift_cards SET balance = balance - ?
                    WHERE code = ? AND balance >= ?');
$q->execute([$amount, $code, $amount]);

if ($q->rowCount() !== 1) {
    throw new InsufficientBalance();
}

In our run the first request changed one row and the second changed none.

The best candidates keep going. What stops the same order from being submitted twice? Where’s the unique key? If you hear “it’s in a transaction, so it’s fine,” you’ve learned the most useful thing this exercise can teach you.

One glass of juice with two straws, a picture of two checkouts spending the same gift card balance

The Upgrade Ticket, With Real Dates

Hand over a ticket with one line on it. “Production reports PHP 8.2.34. Plan the upgrade.” These are the dates behind it, from the PHP project’s supported versions page, read on November 28, 2026.

BranchSecurity fixes endWhat a candidate should know
8.1 and olderAlready endedNo regular releases from the project
8.2December 31, 202633 days left as of November 28
8.3December 31, 2027Security fixes only. Minimum for Laravel 13
8.4December 31, 2028Minimum for Symfony 8.2
8.5December 31, 2029A year in service
8.6December 31, 2030Released November 19, 2026

The first thing a strong candidate does is split the ticket in two. Version 8.2.34 is behind on security releases right now. The fix for the PHP2Shell flaws arrived in 8.2.35 in October, and the November 19 security releases took the branch to 8.2.36. Patch this week. Plan the jump separately.

Then pick the destination, and expect the framework to have a say in it. Laravel’s release table puts Laravel 13 on PHP 8.3 or later, while Laravel 12 runs on 8.2 through 8.5, which means a Laravel 12 shop can move the language first and the framework second. Symfony 8.2 wants 8.4. What you want to hear next is some version of running composer why-not php 8.5.0 to find the packages that will block the move, comparing the installed extensions against the target, and then running the test suite there with deprecation notices written to a log that somebody has agreed to read.

Want to push further? Print this.

function findProduct(string $sku = null): array
{
    $cache = [];
    $cache[$sku] = (integer) '5';

    return $cache;
}

findProduct();

Ask what the logs will say. We got silence on 8.3, one deprecation notice on 8.4, and three on both 8.5 and 8.6. The one that starts on 8.4 is the implicitly nullable parameter, fixed by writing ?string. The two that join it on 8.5 are the long-form (integer) cast and null used as an array key. Nobody needs all three from memory. They do need to know a deprecation log exists and that somebody should read it.

Hiring for WordPress or WooCommerce? Swap One In

Drop PR 5 and use this. Same rules, same silence.

add_action('wp_ajax_delete_report', function () {
    check_ajax_referer('delete_report');
    wp_delete_post((int) $_POST['report_id'], true);
    wp_send_json_success();
});

The developer added a nonce check, watched requests without one get rejected during testing, and went home believing that the delete action was now protected against anyone who had no business using it. It isn’t. WordPress says plainly that nonces should never be relied on for authentication, authorization, or access control. The hook fires for any logged-in user. wp_delete_post() doesn’t check permissions on your behalf, the true skips the trash, and nothing confirms the ID belongs to a report at all. Anyone logged in who is handed that nonce can erase a page by number.

The fix is a current_user_can('delete_post', $id) check and a look at the post type before anything is deleted. A WordPress developer who says “capability check” before you finish reading the code is one you want to keep talking to.

Two or Three Pull Requests, Chosen by the Job

Nobody should sit all six. By the fifth one a good developer is tired, a nervous one has stopped thinking out loud, and whatever you hear on the sixth tells you more about stamina than about how they’d review a change on an ordinary working morning.

The seatPut these downBecause
Junior, any stackPR 2 and PR 3Both can be reasoned out with nothing but care
Mid-level Laravel or SymfonyPR 1 and PR 4Everyday feature work with money attached
Senior who owns a servicePR 5 and PR 6Process lifetime and concurrency are what wake people up
Commerce or billingPR 2, PR 4, PR 6Three ways to lose money quietly
Legacy modernization contractorThe upgrade ticket and PR 1They’ll meet old comparisons and old version numbers on day one

For a seat that’s mostly API and schema design, our backend developer interview questions go further than this page does. If the same person owns the front end, borrow from the full stack interview questions too. Running a Rails service next to the PHP one? Our Rails log questions cover that seat.

How to Run the Hour and Grade It

  • Ten minutes on the verbal screen.
  • Fifteen minutes on each of two pull requests, with the candidate writing review comments as if a colleague will read them.
  • Ten on the upgrade ticket.
  • Whatever is left belongs to their questions. Don’t eat it.

I’d keep the scorecard to three boxes per pull request, small enough to fill in on the back of the printout. Box one is a named input or sequence that breaks the code, such as 19.99 or two checkouts landing together. Box two, a test that fails today. Box three is whether they split their comments into what blocks the merge and what can ride along in a follow-up ticket.

Box three gets skipped. A reviewer who blocks a merge over brace placement with exactly the same force they’d use on a forged refund will exhaust your team inside a month, and your developers will start routing their pull requests around that person whenever the calendar allows it. Watch the tone of the comments as well. Somebody on your team will be reading this person’s notes at five on a Friday with a release waiting, and a candidate who writes “did you even test this” across your made-up code has shown you what that afternoon will be like.

Hiring Managers Also Ask

Should the candidate be allowed to run the code?

Let them read first and run second. The first ten minutes with paper show what they notice unaided. Hand over a laptop after that and you’ll see whether they reach for a three-line script, a failing test, or a search engine, which tells you how they’ll chase a real ticket.

Can an AI assistant just answer these for them?

Often it can, at least on the first pass, so grade what happens next. Change a detail, say a customer who signed up on January 30 rather than January 31, and ask which of the printed dates move. If your developers use an assistant at work, let the candidate use one on a shared screen.

Do these work if we run Symfony instead of Laravel?

Five of the six are plain PHP and SQL, so they work on any framework. PR 5 is the one I’d reword, trading queue:work for a Symfony Messenger consumer, which is also a process that stays up between messages. The code on the page doesn’t change.

Nobody on our panel writes PHP. Can we still run this?

You can run it if one engineer from another language sits in, because races, float money, and stale caches aren’t PHP inventions. Every result is printed above. Your Java or Python person only has to judge whether the candidate’s explanation of the cause holds together.

What does a PHP developer cost in 2026?

Plan on $95,000 to $130,000 base for mid-level and $130,000 to $170,000 for senior or lead, per our PHP staffing page, with contract rates of $60 to $115 an hour. Our hiring guide prints a lower mid-level band, so check your metro with the salary benchmark assistant. The Bureau of Labor Statistics doesn’t track PHP separately. Its software developer median was $135,980 in May 2025.

I’m the one being interviewed. How should I practice?

Type each snippet, predict the output on paper, and only then run it. Say your review out loud in under two minutes, starting with whatever would stop you approving it. I’d forgive a forgotten function name long before I’d forgive a cheerful approval of the refund webhook, and I suspect most panels would too.

Open Your Last Ten Merges

Before you copy any of this into an interview plan, spend twenty minutes looking at what your own team shipped this month, ideally with the person who’ll be running the round sitting next to you. Search the repository for == next to request input, for (int) wrapped around a price, and for static properties in any class a queue job touches. Whatever turns up is a better interview question than mine. It’s probably also a ticket.

If you’d like help running the round or filling the seat, tell our recruiters what the codebase looks like. A dated job such as a version upgrade often suits contract staffing, and the person who’ll own the application for years is usually a direct hire. For a yardstick, our average time to hire across IT searches is 17 days, with 12-month retention of 92 percent. Harder PHP seats take longer. Our staffing page puts a senior Magento hire, or a lead for a move off PHP 5, at three to five weeks.