Python-like tuple unpacking for PHP
Python provides a neat way for functions to return multiple arguments via “tuple unpacking”. For example:
def blah: return ('one', 'two') rval_1, rval_2 = blah()
The same can be done in PHP relatively easily via the list construct:
function blah() { return array('one', 'two'); } list($rval_1, $rval_2) = blah();
Comments
Comments powered by Disqus