Try this (I only tested it shortly if it works with scalars, but it should
also with arrays):
#swap $a, $b
 list($a, $b) = array($b, $a);

Stefan Rusterholz, [EMAIL PROTECTED]
----------------------------------
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
----------------------------------
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
----------------------------------
----- Original Message -----
From: "Bharath Bhushan Lohray" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, December 09, 2001 1:24 PM
Subject: [PHP] Variable Swap?


> 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.
>
> -Bharath Bhushan Lohray
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to