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
How to pass variables and data from php to javascript?
Is php free to use?
What's the best method for sanitizing user input with php?
What does pear stand for?
What are the encryption functions in php?
What is use of header() function in php?
Php error constants and their descriptions
What are PHP Magic Methods/Functions. List them.
Explain me how to include a file to a php page?
How To Get the Uploaded File Information in the Receiving Script?
How is csrf token generated?
What is lazy loading in php?
Do you know what is the differences between $a != $B and $a !== $B?
How to receive a cookie from the browser?
hello all, I need some sample placement papers in lion bridge.. can anyone help me?