PHP Technical Blog
Thursday, August 26, 2010
Interchange values of two variables without using third variable
$a = 5;
$b = 3;
$a = $a*$b; //result $a = 5*3 = 15
$b = $a/$b; //result $b = 15/3 = 5
$a = $a/$b; //result $a = 15/5 = 3
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment