back

by alexandercrohde·10y ago·view on hn ↗
On the criticisms of PHP on swap, those are way out of date. Swap in php:

list(a, b) = [b, a]

Multiple return values:

[a, b] = function(){ return ["one value", "another"];};

1 comments
Er, that should be:

  list($a, $b) = [$b, $a];

  list($a, $b) = (function(){ return ["one value", "another"];})();
Anyway, it's not even out-of-date, just ignorant. PHP has list() for at least 16 years.