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
Which are the best start and end tags to use?
Why ide is recommended for use while programming with php?
How do I run a php program in dreamweaver?
What is the meaning of symbol '$' in jquery?
Is php a strongly typed language?
How do I get csrf token?
What is overloading and overriding in php?
What is $_ files in php?
In php, objects are they passed by value or by reference?
Does php support multithreading?
What is php session_start() and session_destroy() function?
How to find the index of an element in an array php?
what is mean by portal
Difference between $message vs. $$Message in php.
What is a php trait?