PHP 7.4's FFI Support Is In Good Shape For Tapping C Functions / Structures From PHP
Written by Michael Larabel in Programming on 25 October 2019 at 04:48 AM EDT. 6 Comments
PROGRAMMING --
One of the interesting features for PHP 7.4 that is due for release at the end of next month is the long-awaited FFI (Foreign Function Interface) support. PHP 7.4's FFI lets developers call functions / variables / data structures defined in the C programming language from native PHP code.

FFI is one of the prominent new features to PHP 7.4 along with the preload feature, hardening the PHP FPM systemd service, TLS 1.3 for OpenSSL streams, and many other changes. The PHP 7.4 FFI approach is comparable to that of FFI implementations for other languages.

Usage of PHP FFI moving forward should yield less of a need for writing new PHP modules for interfacing with C libraries/programs while now can be done using the foreign function interface. For those curious about sample code / examples for PHP 7.4 FFI, Fedora/RedHat PHP packager Remi Collet has written a new blog post outlining some of the use-cases with example code.

Those wishing to learn more about the PHP 7.4 FFI support can also see the documentation on PHP.net and their basic examples. There still are a few more PHP 7.4 release candidates ahead while the general availability is still slated to happen on/around the 28 November.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week