New PHP 8 Released
Blog Standard

New PHP 8 Released

Now PHP 8 is here !! It was released on November 26, 2020.

In the end of 2020, A major change is happened that is, PHP version 8 is introduced.

You can download the latest version here :

Download PHP 8

The major new features in PHP 8 is :

  • Union Types
  • Named Arguments
  • Match Expressions
  • Attributes
  • Constructor Property Promotion
  • Nullsafe Operator
  • Weak Maps
  • Just In Time Compilation

And much more…

New Classes, Interfaces, and Functions

Weak Map class

Weak maps will allow us to create a map from object to arbitary values (which is similar to SplObjectStorage), without preventing the objects that are used as keys from being garbage collected. PHP 7.4 support for weak references was already introduced

Stringable Interface

This RFC introduces a new Stringable interface that is automatically added to classes that implement the __toString() method.


  • Allows using string|Stringable to express string|object using __toString()
  • It provides a forward upgrade path from PHP 7 to 8

str_contains(), str_starts_with(), str_ends_with()

str_contains checks if a string is contained in another string and returns a boolean value (true/false) whether or not the string was found.

str_starts_with checks if a string begins with another string and returns a boolean value (true/false) whether it does.
str_ends_with checks if a string ends with another string and returns a boolean value (true/false) whether it does.


The fdiv() function is part of the fmod() / intdiv() family. It implements a floating-point division with IEEE-754 semantics. That is, division by zero is considered well-defined and does not trigger any kind of diagnostic. Instead one of INF, -INF or NAN will be returned, depending on the case.


This RFC proposes to add a new function get_debug_type that will return the given type of a variable.


This is a more obvious and type-safe form of (int) $resource.

token_get_all() object implementation

The token_get_all() function currently returns tokens either as a single-character string, or an array with a token ID, token text and line number. This RFC proposes to add a token_get_all() alternative which returns an array of objects instead. This reduces memory usage and makes code operating on tokens more readable.

Know More