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 difference between php traits vs interfaces?
Explain what is the difference between $var and $$var?
How do I repair phpmyadmin?
How is it possible to parse a configuration file?
What is laracast?
What is the purpose of basename() function in PHP?
How to redirect a url from http to https in .htaccess?
What are interfaces in php?
What is the difference between print() and echo() in PHP?
What are the string functions in php?
What is the alternative structure for control structures?
What is the mysql injection?
How does the identity operator === compare two values?
What php framework does wordpress use?
What is php key?