note 39445 deleted from function.list by googleguy

From: Date: Thu, 13 Sep 2012 10:09:02 +0000
Subject: note 39445 deleted from function.list by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-190713@lists.php.net to get a copy of this message
Note Submitter: jeronimo at DELETE_THIS dot transartmedia dot com ---- If you want to swap values between variables without using an intermediary, try using the list() and array() language constructs. For instance: <? // Initial values. $biggest = 1; $smallest = 10; // Instead of using a temporary variable... $temp = $biggest; $biggest = $smallest; $smallest = $temp; // ...Just swap the values. list($biggest, $smallest) = array($smallest, $biggest); ?> This works with any number of variables; you're not limited to just two. Cheers, Jeronimo

« previous php.notes (#190713) next »