// books.php

Published by Apress.

Two books on PHP 8 — from fundamentals to cutting-edge language features.

Chapters

Chapter 1

What's New in PHP 8

PHP 8 is a major release that brings significant improvements to performance, type safety, and developer experience. The JIT (Just-In-Time) compiler is perhaps the most talked-about feature — it compiles PHP code to machine code at runtime, offering potential performance gains especially for CPU-intensive applications.

Union types allow a parameter or return value to accept multiple types:

  function process(int|string $value): int|bool {
      // ...
  }

Named arguments let you pass values to a function by specifying the parameter name, making your code more readable and allowing you to skip optional parameters:

  htmlspecialchars(
      string: $html,
      double_encode: false
  );
1 / 4