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 ? | 79 Yes | 6 No |
Post New Answer View All Answers
Write a program in php to find the occurrence of a word in a string?
How to assigning a new character in a string?
Php error constants and their descriptions
Is php 7.0 stable?
How to find datatype of variable in php?
Does apache use php?
What are the php variables?
Explain Booleans in PHP?
How to Retrieve the Session ID of the Current Session?
How to insert a line break in php string?
What are static variables in php?
write a note on Testing the web site
What is the use of curl()?
Tell me what is the use of mysql_real_escape_string() function?
What is composer json?