Hello all I’m new to the forums here… I have a project I’m working on and it requires me to swap the values of two variables x & y.
here is what I have so far:
[php]<?php
$x = 3;
$y = 0.14;
function switch_values(){
global $x, $y;
$x^=$y;
$y^=$x;
$x^=$y;
}
$outcome = switch_values($x, $y);
if (round($x, 2) == 0.14 &&
round($y, 2) == 3 ) {
print “It worked!”;
} else {
print “Try again!”;
}
?>[/php]
Any help appreciated thank you!!