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 is PHP? Who is the father or inventor of PHP?
Can php variables have numbers?
Is there an easy way to delete an element from a php array?
What are the difference between echo and print?
What are the design patterns in php?
What is the difference between array_pop() and array_push()?
Differentiate between require and include?
What are sql injections, how do you prevent them and what are the best practices?
What is artisan in php?
Write the statements that are used to connect php with mysql
When is a conditional statement ended with endif?
Do I need apache for php?
Where session is stored?
Is php a low level language?
What is good average session duration?