21, November 2008

how to swap two variables in one line - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: how to swap two variables in one line
« previous next »
Pages: [1] Print

Author Topic: how to swap two variables in one line  (Read 975 times)
Cyberpunk Wannabe
*
Gender: Male
Posts: 39
172 credits
Members referred : 0



« on: Sep 13, 2005, 10:25:46 PM »

I know this is a nerd thing, but here it is :

Code:
<?php
$a 
30;
$b 50;

$a = ( $a $b ) - ( $b $a );

echo 
$a " " $b;
?>


It works only with numeric variables.
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8249
42481 credits
Members referred : 3



« Reply #1 on: Sep 14, 2005, 12:23:02 PM »

Hehe.  Cool

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Novice Spammer
***
Posts: 100
103 credits
Members referred : 0



« Reply #2 on: Sep 27, 2005, 12:00:02 PM »

Hahah thats tight.
I wish I was an Oscar winner
**
Posts: 86
247 credits
Members referred : 0



« Reply #3 on: Oct 03, 2005, 01:44:23 AM »

Hehe. It sounds like a geek joke Smiley

Very smart
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #4 on: Oct 03, 2005, 05:41:35 PM »

But that is 4 lines of code!

Only teasing... great stuff!


Last blog : Site of the Month - August 2007
I wish I was an Oscar winner
**
Posts: 86
247 credits
Members referred : 0



« Reply #5 on: Oct 03, 2005, 05:47:17 PM »

But that is 4 lines of code!

Only teasing... great stuff!

Actually it is only one : $a = ( $a + $b ) - ( $b = $a );
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #6 on: Oct 03, 2005, 05:57:04 PM »

HAHA... I know! I was teasing...

<?php
1. $a = 30;
2. $b = 50;

3. $a = ( $a + $b ) - ( $b = $a );

4. echo $a . " " . $b;
?>

Sorry if my sense of humour is a bit corny, you'll get to know me! I also stir a lot too.


Last blog : Site of the Month - August 2007
I wish I was an Oscar winner
**
Posts: 86
247 credits
Members referred : 0



« Reply #7 on: Oct 03, 2005, 06:00:57 PM »

Hehehe. This was a rushed post.

Next time I will read more carefully, and I will sleep more at night Smiley
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=210
Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: how to swap two variables in one line
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov 21, 2008, 01:13:39 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.727
Total Topics: 7.649
Total Members: 4.391
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: davous

40 Guests, 5 Users online :

24 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.