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:

  • match and mixed became 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.
  • Resource handles turned into objects for curl, GD, sockets, XML and more, so is_resource() checks break.
  • create_function(), each() and money_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

← All PHP 7 questions