1. Write a function to swap two values ?
$a = 10;
$b = 20;
echo $a, $b;
swap(); // If u want u can pass parameters
echo $a, $b; // It should print 20 , 10
Answer Posted / dinesh kumar
function swap($x,$y)
{
$x^=$y^=$x^=$y;
return array($x,$y);
}
list($a,$b)=swap(5,10);
echo $a;
echo $b;
Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
Explain the three different kinds of Arrays?
What is the function of trim?
What is x+ mode in fopen() used for?
What is the special meaning of __sleep and __wakeup?
What are php variables?
What is the use of "echo" in php?
What does $this do in php?
How to select a database in php?
Is salary a ratio or interval?
What is a controller in programming?
What is framework in php?
What is the function of mysql_real_escape_string in php?
What is get method in java?
What is php call function?
What are php filters?