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 / ramse

One way is:

function swap($x, $y) {
$x ^= $y ^= $x ^= $y;
return array($x,$y);
}

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know how can we check the value of a given variable is a number?

973


What is Mcrypt used for?

1041


When is a conditional statement ended with an endif?

1000


How to access a Static Member of a Class in PHP?

1080


What is the w3c?

8989


What is framework? How it works? What is advantage?

1005


What is reference variable php?

1079


What does $this do in php?

1020


Explain the difference between mysql_connect and mysql_pconnect?

968


How does csrf attack work?

1070


Hi this is amul jani here, i complied my graduation in B.com stream.. but as career i looking for PHP language.. to get shape my career. so is that possible to enter in IT world.. for me how much scope of develop my career in this field.. amul jani

2071


What are some of the advanced features of php?

1038


What is array and function?

1100


What is the role of php.ini file?

1035


What are php magic quotes?

977