Behavioural Senior Level

You inherit a legacy PHP application with no tests, mixed PHP/HTML files, and global state everywhere. How do you approach modernisation?

Quick Tip

Lead with pragmatism: "I would not rewrite it. I would add tests around the most critical paths, extract business logic into classes, and modernise module by module while shipping features."

What good answers include

Best answers describe a pragmatic, incremental approach: add characterisation tests first, then extract logic from templates, introduce autoloading, wrap global state in injectable services, and migrate one module at a time. Strong candidates discuss the Strangler Fig pattern, setting up CI early, and resisting the urge to rewrite from scratch. They balance technical debt reduction with delivering business value.

What interviewers are looking for

Tests real-world maturity. Junior developers often want to rewrite everything. Seniors know that incremental modernisation is safer and more sustainable. Ask what they would do first and why.

← All PHP questions