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 / meenakshisundaram
$a = 10;
$b = 20;
echo $a, $b;
swap();
echo $a, $b;
swap(){
list($a, $b) = array($b, $a);
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Explain about PHP filter and why it should be used?
What is design pattern? Explain all including singleton pattern?
How to find the length of a string?
Tell me what does the initials of php stand for?
What is the value for this auto incremented field user_pri_id?
What is the use of explode() function?
What is the difference between characters 23 and x23?
How to get the number of characters in a string?
Which is the best php framework for a beginner?
How to delete an element from an array?
What does the unlink() function means?
What is the best way to test the strpos() return value in php?
What is the purpose of pear in php?
Explain me what is the importance of "method" attribute in a html form?
Is php an object or array?