PHP 7 interview question · Most asked
What are the main breaking changes when upgrading from PHP 7.4 to 8.0?
Summary
Key breaks: saner string/number comparisons, many internal-function warnings became TypeError/ValueError, removal of 7.x-deprecated features, PHP 4 constructors removed, stricter arithmetic on arrays/objects, and changed default error reporting.
Longer Answer
Other notable changes:
matchandmixedbecame reserved keywords.- Private methods are no longer inheritance-checked against parent signatures, while abstract trait method signatures are now checked.
@no longer silences fatal errors.- Sorting became stable.
Resourcehandles turned into objects for curl, GD, sockets, XML and more, sois_resource()checks break.create_function(),each()andmoney_format()were removed.
Tooling such as Rector, PHPStan and PHPCompatibility automates most of the detection.
Key Points
0 == 'a'now false- Internal functions throw TypeError/ValueError
- Resources → objects (curl, GD, ...)
- Removed functions:
each,create_function - Use Rector + PHPCompatibility
Explanation
What interviewers look for
Real-world upgrade experience and a systematic approach, not just a list.
Follow-up questions
- How did you test behavior changes caused by comparison semantics?
More most-asked PHP 7 questions
- What are typed properties in PHP 7.4?
- How do return type declarations work in PHP 7?
- What were the headline improvements of PHP 7.0 over PHP 5.6?
- Explain scalar type declarations and coercive vs strict mode in PHP 7.
- Explain the `Throwable`, `Error` and `Exception` hierarchy introduced in PHP 7.
- What are nullable types in PHP 7.1?
- What does the null coalescing operator `??` do, and how is it different from `isset()` with a ternary?
- What are arrow functions in PHP 7.4 and how do they differ from closures?