Exploring more concise syntax with PHP 7.4


I am really excited about the latest version of PHP (PHP 7.4) because the syntax is more concise, so it makes writing code a lot more efficient! Here's an example:

EXAMPLE 1 - Using new arrow functions:

Using a very basic example, have a look at how I wrote the two different versions of the same code where the task was to output the number '3'.

The first part of the code uses the usual PHP syntax, whilst the second part of the code uses the new arrow functions in PHP 7.4. This makes it more concise, easier to write and more readable.

Part of PHP code using PHP 7.4 syntax


Instead of writing a long code like this in a registration form: Part of PHP code for a registration form

I can instead write a more concise version of the above code, like this: PHP code using more concise PHP 7.4 syntax

This is such an amazing improvement to the PHP syntax!