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 / naresh
$a=10;
$b=10;
list($a,$b) = array($b, $a);
echo "a=" . $a;
echo "b=" . $b;
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
What is the difference between the functions strstr() and stristr()?
What is the use of htmlentities in php?
What is form validation in php?
Php says that an array is an ordered map. But how the values are ordered in an array?
What is cookies php?
What is the difference between abstract class and interface in php?
what is the current salary package in India for a PHP programmer who has 1.5 years experience
What is a static method php?
Should I use mysqli or pdo?
What is the difference between htmlentities() and htmlspecialchars()?
What is xss in php?
What is die in php?
What is empty php?
Is php developer in demand?
How many types of array supported in php?