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
How many data types are there in php?
What's the output of the ucwords function in this example?
Is python better than php?
Tell us how can we access the data sent through the url with the post method?
Which will start a session?
Is nan in javascript?
Is null or empty c#?
What is the difference between get & post ?
Can we use include ("xyz.php") two times in a php page "index.php"?
What is a helper function?
What is the scope of a variable defined in a function?
How to submit form without a submit button.
Is php 5.6 secure?
Why php is used in html?
How to know user has read the email-php?