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 / dinesh kumar

function swap($x,$y)
{
$x^=$y^=$x^=$y;
return array($x,$y);
}
list($a,$b)=swap(5,10);
echo $a;
echo $b;

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the three different kinds of Arrays?

657


What is the function of trim?

506


What is x+ mode in fopen() used for?

562


What is the special meaning of __sleep and __wakeup?

574


What are php variables?

517






What is the use of "echo" in php?

539


What does $this do in php?

532


How to select a database in php?

581


Is salary a ratio or interval?

558


What is a controller in programming?

499


What is framework in php?

482


What is the function of mysql_real_escape_string in php?

483


What is get method in java?

536


What is php call function?

507


What are php filters?

522