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
What are the benefits of composer?
What is difference between print and echo in php?
How to get the directory name out of a file path name?
How to set cookies?
With a heredoc syntax, do I get variable substitution inside the heredoc contents?
Which is useful for method overloading?
How to get length of an array in PHP?
What function should you use to join array elements with a glue string?
How to create a table to store files?
What is use of header() function in php? What the limitation of header()?
What is member function?
Tell us how can we access the data sent through the url with the post method?
Write down the code for save an uploaded file in php.
What is array and function?
Which is variable cost?