Created
May 12, 2018 20:24
-
-
Save whoisryosuke/7009b7a750c390d74b014e1e9a6996e1 to your computer and use it in GitHub Desktop.
Specify the variables for keys in arrays in PHP7 -- found via: https://blog.frankdejonge.nl/array-destructuring-in-php/
This file contains 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
<?php | |
$members = [ | |
[1, 'Seb'], | |
[2, 'Alex'], | |
[3, 'Brent'], | |
]; | |
foreach ($members as [$id, $name]) { | |
// do stuff with $id and $name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment