Say for instance I have ...
$var1 = \"ABC\" $var2 = 123
and under certain conditions I want to sw
Yes, there now exists something like that. It's not a function but a language construct (available since PHP 7.1). It allows this short syntax:
[$a, $b] = [$b, $a];
See "Square bracket syntax for array destructuring assignment" for more details.