Blog Archives

Swapping values in PHP

It’s always a good thing to search for something cool that you’ve found before blogging it, to make sure that others have not already done the same  It even helped me see a PHP trick that should be familiar to seasoned C/C++ programmers…

Oh, and for those who want to read it here as well, here’s a one-liner to swap the values of two variables in PHP:

list($a, $b) = array($b, $a);

Posted in Blog Tagged with: