PHP 7.4 Gets Foreign Function Interface
Written by Alex Armstrong   
Monday, 02 December 2019

The latest version of PHP has been released with improvements including typed properties, arrow functions, and a foreign function interface. 

PHP's migration from a simple scripting language designed to build web pages programatically to a very general server side web language means that this open-source runtime now serves eight out of ten websites using server-side code. 

phplogo

PHP 7.4.0 comes with numerous improvement, starting with typed properties meaning that class properties now support type declarations. Arrow function support has been added, providing a shorthand syntax for defining functions with implicit by-value scope binding. This is designed to make code using simple closures easier to read and understand.

Limited return type covariance and argument type contravariance support has been added, though full variance support is only available if autoloading is used. Support has also been added for unpacking inside arrays. Other improvements include the ability to separate numeric literals by using an underscore between digits; weak references so you can retain a reference to an object that does not prevent the object from being destroyed; and exceptions from __toString() are now permitted. Previously this resulted in a fatal error.

The performance of this version of PHP has been improved, partially due to support for Opcache preloading code. With an opcode cache, files are compiled once (on the first request that uses them), and are then stored in shared memory.  Their contents are then permanently available to all subsequent requests that will be served by that server. All the functions and classes defined in these files will be available to requests out of the box, exactly like internal entities (e.g. strlen() or Exception). This does mean the files can't be changed without a server restart.

PHP 7.4 is available for download from the PHP downloads page.    

phplogo

More Information

PHP Website

Related Articles

PHP Is Best?

What PHP Does

PHP Variables and Expressions for Complete Beginners

Object-oriented HTML Generation In PHP

Peachpie Open Source PHP to .NET Compiler

PHP 5.6 Released

PHP Gets A Formal Specification 

The Next Version Of PHP And The Status Of PHPng

PHP Next Generation Project Announced       

The Reason For The Weird PHP Function Names       

Zend Optimizer+ For PHP?

More Information

some text

Related Articles

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


GNU Head Drawing Fetches $40K
28/03/2025

Eighteen items of FSF memorabilia that used to adorn the organization's offices were auctioned of last weekend at the culmination of an online auction. The highest bid, as anticipated, was for the ico [ ... ]



Time To Change The Clocks
30/03/2025

This is the time of year when the clocks change to provide us with daylight saving and a significant trauma. The time is ripe to think of innovative clocks and one thing about clocks is that they suit [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 02 December 2019 )