Chapter 2. New Features in PHP 7

PHP 7 has introduced new features that can help programmers write high-performing and effective code. Also, some old-fashioned features are completely removed, and PHP 7 will throw an error if used. Most of the fatal errors are now exceptions, so PHP won't show an ugly fatal error message any more; instead, it will go through an exception with the available details.

In this chapter, we will cover the following topics:

  • Type hints
  • Namespaces and group use declarations
  • The anonymous classes
  • Old-style constructor deprecation
  • The Spaceship operator
  • The null coalesce operator
  • Uniform variable syntax
  • Miscellaneous changes

OOP features

PHP 7 introduced a few new OOP features that will enable developers to write clean and effective ...

Get PHP 7: Real World Application Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.