14 lines
246 B
Plaintext
14 lines
246 B
Plaintext
|
Array destructuring
|
||
|
-----
|
||
|
<?php
|
||
|
|
||
|
[$a, $b] = [$c, $d];
|
||
|
[, $a, , , $b, ,] = $foo;
|
||
|
[, [[$a]], $b] = $bar;
|
||
|
['a' => $b, 'b' => $a] = $baz;
|
||
|
-----
|
||
|
!!php7
|
||
|
[$a, $b] = [$c, $d];
|
||
|
[, $a, , , $b, ] = $foo;
|
||
|
[, [[$a]], $b] = $bar;
|
||
|
['a' => $b, 'b' => $a] = $baz;
|