Skip to content

Instantly share code, notes, and snippets.

@gonaumov
Created August 20, 2019 17:52
Show Gist options
  • Save gonaumov/c7a4e54dd7d1d4f31c0b1136514aada9 to your computer and use it in GitHub Desktop.
Save gonaumov/c7a4e54dd7d1d4f31c0b1136514aada9 to your computer and use it in GitHub Desktop.
Since PHP 7.1 we can destruct array in JavaScript style. :)
georginaumov@virtualbox:~/Documents$ php -a
Interactive mode enabled
php > ['first' => $first, 'second' => $second] = ['first' => 'Tom', 'second' => 'Jerry'];
php > var_dump([$first, $second]);
array(2) {
[0]=>
string(3) "Tom"
[1]=>
string(5) "Jerry"
}
php >
georginaumov@virtualbox:~/Documents$ ^C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment