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
What is the purpose of constant() function?
Can you use php and javascript together?
Do you have to initialize variables in php?
Does strlen include null?
How is it possible to parse a configuration file?
What is the difference between substr() and strstr()?
What is magic quotes?
Explain me is multiple inheritance supported in php?
How does html form submit work?
How would you open a directory for reading in php?
Explain what does $_server means?
Explain me the difference between include and require?
what is the current salary package in India for a PHP programmer who has 1.5 years experience
What is the sign to start variables in PHP?
How do you find the length of a string in php?