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
Does php require a web server?
What are the different types of PHP arrays?
Can php run without apache?
What is the function of string in c?
What are the different loops in php?
Explain a resource?
What is binary safe function in php?
What does the unset() function mean?
Do you know how to enable error reporting in php?
How can you send email in php?
Where is session value stored?
Tell us how can we access the data sent through the url with the post method?
What are the popular content management systems (cms) in php?
What is regular expression in php?
How would you determine the size of a file in php?