Write a PHP program to swap two variables.
<?php $a = 15; $b = 276; echo "\nBefore swapping: ". $a . ',' . $b; list($a, $b) = array($b, $a); echo "\nAfter swapping: ". $a . ',' . $b."\n"; ?>
Sample Output:
The number before swapping is: Number a =15 and b=27 The number after swapping is: Number a =27 and b=15
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer