Re: Simple question that I can't find the answer to

From: Date: Mon, 15 Jan 2001 10:13:34 +0000
Subject: Re: Simple question that I can't find the answer to
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-5021@lists.php.net to get a copy of this message
Depends on why you want to lop it down to a single line? Is this to make your code tidier, or to improve execution time (the latter I doubt, as it won't take long to perform the code you describe!). The neat solution would obviously be a function (maybe even in javascript!) that takes the parameters date1 and date2 and does the following: - if $date1 > $date2 { $sql_date1 = $date1; $sql_date2 = $date2; } else { $sql_date1 = $date2; $sql_date2 = $date1; } "Asendorf, John" wrote: > Is there a single line of code to do the following? > > I'm trying to interchange two variables' contents... I can do it with the > following, but I was just wondering... I can't find it if there is... > > $a = "abc"; > $b = "def"; > > $temp = $b; > $b = $a; > $a = $temp; > > //now $a = "def" and $b = "abc" > > Thanks in advance, > > John > > --------------------- > Founder of > The 'What Kind of Idiot Uses PHP with IIS with Oracle on NT?' Consortium > > Members: John Asendorf, Thomas Kryger, Florian Clever, Ron Woods, Bod > > John Asendorf - jasendorf@lcounty.com > Web Applications Developer > http://www.lcounty.com - NEW FEATURES ADDED DAILY! > Licking County, Ohio, USA > 740-349-3631 > > Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur. > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.windows (#5021) next »