通过使用list方法,我们可以仿造出类ruby/Go语言的特性, 这是GO语言的写法
func swap(x, y string) (string, string) { return y, x } a, b := swap("hello", "world")
PHP也能干这样的事情,请看这样一段代码
function query($request) { // do something return array($result, $isValid); } list($result, $isValid) = query($request); if ($isValid) { // use the result } else { // deal the exception }