Re: [PHP-LANG] Variable Swap

[email protected] ("Mike Frazer") Thu, 24 Jan 2002 00:29:27 -0800
Newsgroups php.lang
Message-ID <[email protected]>
If you're going to be using this a lot, why not just create a function to do
it?  You'll have that third variable but it will be destroyed every time the
function breaks.  Low system overhead in that case.

Mike



"Yasuo Ohgaki" <[email protected]> wrote in message
news:[email protected]...
> Andrei Zmievski wrote:
>
> > 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.
> >>
> >
> > list($b, $a) = array($a, $b);
> >
> > -Andrei
> > * Reality isn't all it's cracked up to be. *
> >
>
> This is nice code.
> I didn't think of that :)
>
> Question is which is faster & memory efficient,
> but there wouldn't be much difference though.
>
> --
> Yasuo Ohgaki
>