Destructuring assignment in php

3 years ago

RomkaLTU

Code

$arr = [
	'red',
	'yellow',
	'gray',
	'black',
];

[$first,$second] = $arr;

echo $second;

Output

yellow
New course: Desktop apps with Electron