What’s new in PHP 7.4

19.12.2019 3,233 13

PHP 7.4 is now readily available and it’s the fourth feature update to the PHP 7 generation. It has several new features, saying goodbye to some older stuff.

PHP 7.4 brings big performance boosts and some much needed improvements to code readability. There are some important new additions. Let’s take a look.

The new Arrow functions

PHP 7.4 introduces Arrow functions, a.k.a. “short closures”. They remove the need for the “use” keyword and you can use “$this” like normal closures. You can use Arrow functions to write one-liner functions.

Typed Properties

This is another big change to PHP 7.4 and it means that class properties now support type declarations. All types are supported, with the exception of “void” and “callable”, but you can use them with the “var” notation.

Weak References

This class allows to retain a reference to an object that doesn’t prevent the object from being destroyed. It’s basically the same as “str_split”, but for multi-byte strings.

Opache preloading

This can bring significant performance boosts, if you’re using a framework. Preloading allows the server to load the PHP files in the memory on startup and they will be permanently available. You can execute these files for any future request. A downside is that if the source of the preloaded files changes, then you have to restart the server.

Custom object serialization

This adds two new magic methods: “_serialize” and “_unserialize”. They combine the two existing mechanisms and this should make a more readable and reliable code.

Things that we say goodbye to

It’s actually a long list of stuff that is going away. Among them are:

  • Nested ternary operators without explicit parentheses
  • Array and string offset access using curly braces
  • (real) cast and is_real() function
  • Unbinding $this when $this is used
  • allow_url_include INI option
  • “parent” keyword without parent class
  • Using array_key_exists() on objects
  • Magic quotes functions
  • Implode with historical parameter order
  • FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead.
  • Passing a non-string pattern to mb_ereg_replace() is deprecated.
  • Passing the encoding as 3rd parameter to mb_strrpos() is deprecated.

PHP 7.4 also brings some changes by removing extensions from the core. In this case three extensions are moving to PECL and are no longer part of the PHP distribution. They are:

  • Firebird/Interbase
  • Recode
  • WDDX

As expected, there are a few more changes that are coming in PHP 7.4.0. The official release notes features them in detail.

13 replies on “What’s new in PHP 7.4”

kkbkinfo5site

Супер давно искал

kkbkinfo5site

Огромное тебе СПАСИБО

Partner betflix 2k

… [Trackback]

[…] There you can find 89503 additional Info on that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

אחסון אתרים מחיר

… [Trackback]

[…] Here you will find 18029 additional Information on that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

พิมพ์สติกเกอร์ฉลากสินค้าแบบม้วน

… [Trackback]

[…] Read More here on that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

หวยฮานอย

… [Trackback]

[…] Read More here on that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

obeng bet

… [Trackback]

[…] Information on that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

รับทำ SEO

… [Trackback]

[…] Read More on that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

David

… [Trackback]

[…] There you will find 69505 more Information on that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

ทำความรู้จักกับค่ายเกม Play’n GO

… [Trackback]

[…] Read More here to that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

คำเตือนก่อนเล่นหวยลาว รู้ก่อนรวยก่อน

… [Trackback]

[…] Here you will find 78135 more Information on that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

PGSLOT บนมือถือ รองรับทุกระบบ อัพเดทใหม

… [Trackback]

[…] Find More Info here on that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

สล็อตเว็บตรง ลิขสิทธิ์แท้ จาก U.S.A

… [Trackback]

[…] Find More to that Topic: blog.neterra.cloud/en/whats-new-in-php-7-4/ […]

Leave a Reply

Your email address will not be published.