Created
July 6, 2013 19:09
-
-
Save nelsonsar/5940906 to your computer and use it in GitHub Desktop.
PHP tuples. With PHP we can make Python tuples using an array and the list function, this is not built-in, but it's a way to make code more readable!
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 | |
function return_fake_tuples() | |
{ | |
return array( | |
'apple', 'banana' | |
); | |
} | |
list($apple, $banana) = return_fake_tuples(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because your gist ranks high on Google while not being up-to-date, I've created one, that is representing tuples using short array syntax and [] destructuring. See: https://gist.github.com/tbreuss/17b94b8bd74124ff75039a2b03a380c0