Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

what is the use of include_once in php?

1053


What does $this do in php?

970


Explain what are psrs? Choose 1 and briefly describe it?

972


What's the difference between using mysql_ functions and pdo?

1161


What is the difference between html and php?

993


How to redirect a url from http to https in .htaccess?

985


How does php work with apache?

1065


Tell me whether it is possible to share a single instance of a memcache between multiple php projects?

989


Why sessions are used in php?

958


What is variable and data type?

1034


Tell me what sized websites have you worked on in the past?

897


What are the rules for naming a php variable?

1054


Do you know how can php and html interact?

1007


What are the different ways to login to a remote server?

1016


How to pass variables by references?

999