any one please help me, i want to know how to swap two variables say, a and b with out using a third vaiable
elanorejoseph
0
Light Poster
Recommended Answers
Jump to Posthi
you can swap a,b like$a=5; $b=7; echo "befor swaping value"."a=".$a."b=".$b; $a=$a+$b;//$a=12 $b=$a-$b//12-7 so $b hold 5 $a=$a-$b//12-5 so $a hold 7 echo "after swaping value"."a=".$a."$b=".$b;
i hope you can understand my logic
Thanks
All 4 Replies
Tulsa
1
Junior Poster in Training
elanorejoseph
0
Light Poster
oakleymk
0
Newbie Poster
elanorejoseph
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.