PHP 7.1 – Symmetric array destructuring

In this post, I will show you how you can use the new Symmetric array destructuring feature of PHP7.1 version. In the previous version of PHP, we used list method to destructure arrays for assignments.

The shorthand array syntax ([]) may now be used to destructure arrays for assignments (Including within foreach), as an alternative to the existing list() syntax, which is still supported.

Symmetric array destructuring

Symmetric array destructuring within foreach

With named keys

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun
I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status