Upgrade to Pro — share decks privately, control downloads, hide ads and more …

New features in PHP8.4

New features in PHP8.4

In this talk, Release Manager from PHP 8.4 introduces some new features of PHP 8.4. She also presents some breaking changes of the upcoming release.

(betterCode PHP 2024)

Saki Takamachi

November 21, 2024
Tweet

More Decks by Saki Takamachi

Other Decks in Technology

Transcript

  1. About me • PHP8.4 RM • PHP Foundation Core Developer

    • specialty: ext/pdo, ext/bcmath • Singer • Have 4 year old son and 1 year old daughter
  2. About smaller new features and changes • RoundingMode Enum •

    PDO Firebird Transaction isolation level …etc There are quite a lot of them, so I will introduce the ones I was involved with.
  3. RoundingMode Enum Added four new modes and now them using

    the correct wording. The words "UP" and "DOWN" are intentionally not used because they are easily confused with the previous mode names.
  4. RoundingMode Enum union type. We assume the int type it

    will be abolished at some point, but the timing is completely undecided.
  5. PDO Firebird Transaction isolation level • There was no way

    to set transaction isolation level • Until now, it was always "Read committed"
  6. About major new features • Asymmetric visibility property • Lazy

    object • PDO driver specific sub-classes • Property hooks • BcMath\Number Class …etc
  7. PDO driver specific sub-classes • pdo_dblib • pdo_firebird • pdo_mysql

    • pdo_odbc • pdo_pgsql • pdo_sqlite ※ pdo_oci has been unbundled.
  8. PDO driver specific sub-classes • Pdo\Dblib • Pdo\Firebird • Pdo\Mysql

    • Pdo\Odbc • Pdo\Pgsql • Pdo\Sqlite ※ pdo_oci has been unbundled. ※ Unbundled drivers can be subclassed as well.
  9. Property hooks fullName is a virtual property. There is no

    need to persist data, as a return value is always generated.
  10. Property hooks Since it has become easier to use public

    properties, there will likely be more opportunities to specify properties in interfaces.
  11. BCMath performance gain PHP 8.3 • add: 3.0387s • sub:

    3.0248s • mul: 5.7315s • div: 25.762s Results of a certain benchmark (rough) Calculate numbers with a maximum of about 60 digits instead of unrealistically large values PHP 8.4 • add: 1.4444s • sub: 1.4745s • mul: 2.0621s • div: 2.9411s
  12. BcMath\Number Class Since it is a Final class, inheritance is

    not possible. There was a very long discussion about whether or not to allow inheritance.
  13. BcMath\Number Class The argument also accepts int. Be careful when

    passing a float, as an implicit cast to int is attempted, not to string.
  14. BcMath\Number Class If you do not explicitly specify the scale

    of the result, add up to 10 to "dividend Scale."
  15. BcMath\Number Class GMP does not handle decimals, so it does

    not compete completely with BCMath, and each has its place.