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
What is faster in php?
what does this symbol mean in php?
What is the use of header in php?
What are the differences between session and cookie?
How do you parse and process html/xml in php?
How to include a file code in different files in php?
Which is the dependent variable?
Explain Booleans in PHP?
List some of the features of php7.
Is php a case sensitive language?
How do you pass a variable by value in php?
What is api example?
Explain which cryptographic extension provide generation and verification of digital signatures?
How we load all classes that placed in different directory in one php file , means how to do auto load classes.
How do you explain independent and dependent variables?