Re: Variable Swap?

From: Date: Tue, 11 Dec 2001 12:31:32 +0000
Subject: Re: Variable Swap?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77290@lists.php.net to get a copy of this message
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, s.rusterholz@interaktion.ch ---------------------------------- 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" <bhloh@users.sourceforge.net> To: <php-general@lists.php.net>; <php-lang@lists.php.net> 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.general (#77290) next »