Categories
PHP / MySQL

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

By Arjun

I am Arjun from Hyderabad (India). I have been working as a software engineer from the last 7+ years, and it is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.

Leave a Reply

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