I mean something like this:
$arr = ["1", "2", "3"];
$one;
$two;
$three;
$new = [$one, $two, $three] = $arr;
As result I should get:
$one = 1;
$two = 2;
$three = 3;
I tried, it works in PHP 7.3.2:
var_dump($one); // returns 1
I mean something like this:
$arr = ["1", "2", "3"];
$one;
$two;
$three;
$new = [$one, $two, $three] = $arr;
As result I should get:
$one = 1;
$two = 2;
$three = 3;
I tried, it works in PHP 7.3.2:
var_dump($one); // returns 1
Indeed, it is listed as a new feature in PHP 7.1:
The shorthand array syntax (
[]) may now be used to destructure arrays for assignments (including withinforeach), as an alternative to the existinglist()syntax, which is still supported.