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 / binoyav
$a = 10;
$b = 20;
echo $a, $b;
echo "<br>";
swap($a, $b);
echo $a, $b;
function swap(&$a, &$b)
{
$temp = $a;
$a = $b;
$b = $temp;
}
| Is This Answer Correct ? | 80 Yes | 6 No |
Post New Answer View All Answers
Is php still used?
Tell me what is the actually used php version?
armstrong number by using php while number is given by the keyboard.?
How to retrieve the original query string?
Tell me what is needed to be able to use image function?
Tell me what is the use of mysql_real_escape_string() function?
How to connect to mysql from a php script?
So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()?
Is php faster than javascript?
When sessions ends?
What is session in c#?
What is a session in php?
What are the advantages of stored procedures, triggers, indexes in php?
How to access a specific character in a string?
Explain me what is the goto statement useful for?