SOLUTION: Write a PHP program to swap two variables. The output should be like: The number before swapping is: Number a=15 and b=27 The number after swapping is: Number a=27 and b=15

Algebra ->  Test -> SOLUTION: Write a PHP program to swap two variables. The output should be like: The number before swapping is: Number a=15 and b=27 The number after swapping is: Number a=27 and b=15      Log On


   



Question 1183006: Write a PHP program to swap two variables.
The output should be like:
The number before swapping is: Number a=15 and b=27
The number after swapping is: Number a=27 and b=15

I used this :
$a = 15;
$b = 27;

echo "\nThe Number before swapping is:\n";
echo "Number a = ".$a." and b = ".$b."\n";

$temp = $a;
$a = $b;
$b = $temp;

echo "\nThe number after swapping is: \n";
echo "Number a = ".$a." and b = ".$b."\n";
?>
But cannot figure how to get the lines separated comes out as one solid row vs the way I inputted above a row for each statement.
Thank You

Answer by ikleyn(52781) About Me  (Show Source):
You can put this solution on YOUR website!
.

At this forum, we do not help in writing any computer programs.