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 / binoyav
The above answer is correct. But the interviewer does not
want to echo the values from inside the function. It should
be in the following way
$a = 10;
$b = 20;
echo $a, $b;
swap(); // Here if you want you can pass the variables
echo $a, $b;
function swap()
{
}
| Is This Answer Correct ? | 8 Yes | 7 No |
Post New Answer View All Answers
How to concatenate two strings together in php?
Why is used in php?
How can you retrieve a cookie value?
How to check a variable is array or not in php?
What is the difference between get and post method in php?
What is use of mysqli_query in php?
How do I display php errors?
What is cookie?
How to write comment in php?
Which is faster for or foreach php?
How do you debug php?
Does strlen include null?
Which is better get or post method?
What is an object in php?
How to include variables in double-quoted strings?