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


Please Help Members By Posting Answers For Below Questions

i m a B.E,passed out few yrs bak failed to find good job due to less marks now thinkin of a career as PHP developer. is it a lucarative field and wat r career prospects; hv heard dat initial salary is very less bout 6k also most jobs r contrct jobs.pls guide me need ur valuable advice.pls hellppp!! thnx..

1873


Why use php artisan serve?

698


What is super keyword in c++?

767


Explain include(), include_once, require() and require_once?

729


Which function is used to read a file removing the html and php tags in it upwork?

714


What is string and its function?

754


How can we change the value of a constant?

728


How is it possible to propagate a session id?

719


What is the actually used php version?

758


How do you sort an array in php?

753


How to read one character from a file?

797


What is trim codeigniter?

742


What is $$ in php?

729


What does $_ post mean in php?

844


Suppose your zend engine supports the mode Then how can you configure your php zend engine to support Mode ?

770