Skip to content
On this page

An image

ray.so

Array destructuring in PHP

On PHP you can destructure the array into separate variables.

Note that the word is "destructure", not "destruction" — that's something different

php
<?php
/** github.com/muath-ye */

[$hi, $name] = ['Hello', 'Muath'];

echo $hi . ' ' . $name; // Hello Muath

Last updated: