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 Gd PHP?
Is php class name case sensitive?
What are the functions of string?
What is delimiter php?
How to download and install php on windows?
Does session expire on closing browser?
Write a program to get lcm of two numbers using php?
What are the array functions in php?
Which is the best web server?
Is there an easy way to delete an element from a php array?
What is rtrim php?
How to reset/destroy a cookie in php?
Why are sessions used?
How to check a variable is an array or not in php?
Which method removes the last element from the end of an array?