Created
August 20, 2019 17:52
-
-
Save gonaumov/c7a4e54dd7d1d4f31c0b1136514aada9 to your computer and use it in GitHub Desktop.
Since PHP 7.1 we can destruct array in JavaScript style. :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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