PHP 8 logo

PHP 8.4 Alpha 1 available now!

Let’s dive in to the testing release of PHP 8.4


The release of PHP 8.4 marks another significant milestone in the evolution of one of the web’s most widely used programming languages. Building on the robust foundation of its predecessors, PHP 8.4 introduces a variety of new features, performance enhancements, and improvements that aim to make development more efficient and enjoyable.

Please do not use PHP 8.4 Alpha 1 in production, this is an early testing release.

We have covered two exciting features in other posts, Array Inspection Functions and Property Hooks. Let’s now take a peek at some other goodies.

MB Functions

String functions like ltrim, rtrim, and ucfirst have existed for a long while now. PHP 8.4 now includes support for multibyte strings too, taking the same arguments as it’s basic string counterparts.

  • mb_ucfirst()
  • mb_lcfirst()
  • mb_ltrim()
  • mb_rtrim()
  • mb_trim()

DateTime from a timestamp

Previously, creating a datetime object from a timestamp was fumbly and a little verbose. PHP 8.4 makes this easier with a createFromTimestamp method.

$timestamp = 1720694974;
$dt = DateTimeImmutable::createFromTimestamp($timestamp);
$dt->format("d/m/Y"); // 11/07/2024

Initialising a class without parenthesis

This one was always a bit silly, but previously you’d need to write something like (new Foo())->someMethod() to initialise and call a method immediately.

Now you can lose the initial parenthesis as new Foo()->someMethod().

Conclusion

PHP 8.4 comes with a good array of features and improvements, we have listed only a few of them here. For a more full breakdown, head over to the PHP page here and to download 8.4.0 Alpha 1, either the PHP repository or the Docker container available on Docker Hub.

Again, please do not use this in production systems.

Leave a Reply

Your email address will not be published. Required fields are marked *

Learn how your comment data is processed to reduce spam here.

Achieve your goals through technology.

Get in touch to discuss your challenges and goals, we are here to make your business succeed.

First Name
Email
Phone
The form has been submitted successfully!
There has been some error while submitting the form. Please verify all form fields again.

Or, visit our contact page here.

Our Services

Web Development

From simple landing pages to complex web applications, we have you covered.

Operational systems

Automation

By transforming repetitive, manual tasks into automated systems, you can free up precious time to actually run your business.

Maintenance

Some much needed TLC for existing projects.