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
Do you know how to enable error reporting in php?
Which are the best start and end tags to use?
What are the characteristics of php?
What is difference Between PHP 5 and 7?
How to get a total number of elements used in the array?
What is the special meaning of __sleep and __wakeup?
What is substr in php?
How to get elements in reverse order of an array in php?
What is reference variable php?
What is meant by MIME?
How to assigning a new character in a string?
How to get the length of string?
Why do we use cookie?
What does the scope of variables means?
Do you know what is the use of rand() in php?