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 / ranjan
function swap(){
$a = 10;
$b = 20;
$a = $a + $b;
$b = $a - $b;
$a = $a - $b;
echo $a, $b;
}
| Is This Answer Correct ? | 45 Yes | 25 No |
Post New Answer View All Answers
How to find the length of a string?
What is data structure in php?
What is an array in php?
Write a program to find no of days between two dates in php?
Which function can be used to exit from the script after displaying the error message?
What are the benefits of using php and mysql?
What is the function file_get_contents() usefull for?
How to run the interactive php shell from the command line interface?
Which is useful for method overloading?
How to get ip address of a server in php?
How to convert strings in hex format?
Is age interval or ordinal data?
What is the current php version?
What is in a cookie?
Tell me how can we connect to a mysql database from a php script?