Re: Variable Swap

From: Date: Tue, 11 Dec 2001 09:35:58 +0000
Subject: Re: Variable Swap
References: 1  Groups: php.lang 
Request: Send a blank email to php-lang+get-253@lists.php.net to get a copy of this message
On Mon, 10 Dec 2001, Bharath Bhushan Lohray wrote: > Is there a way of swapping the values of two variables without involving a > third variable. > > something similar to the SWAP(A$,B$) of BASIC > > I have a big variable(array) and I want to keep my script's memory > requirements as low as possible. Doing this will not copy array's: (PHP only copies if you change it (copy-on-write)) $v = array(...); $w = array(...); $z = $v; $v = $w; $w = $z; regards, Derick

« previous php.lang (#253) next »