+ 1

Write a Program to swap two numbers in PHP.

19th Jul 2017, 5:21 PM
Mansoor. E
Mansoor. E - avatar
2 Answers
+ 5
<?php $a=101; $b=202; $a=[$b,$b=$a][0]; echo $a.":".$b; ?> Oh wait. you want only number. But mine do any type of value.... :(
19th Jul 2017, 6:25 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 1
<?php $a = 25; $b = 32; $a ^= $b; $b ^= $a; $a ^= $b; echo $a; echo "\n"; echo $b; ?>
19th Jul 2017, 5:30 PM
ChaoticDawg
ChaoticDawg - avatar