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

What is implode() in php?

1026


What is use of count() function in php?

976


Do you know how to delete a file from the system?

959


What is a namespace in php?

904


What is composer used for?

894


What is a php form?

958


How do I repair phpmyadmin?

899


What is the difference between $message and $$message in php?

921


Explain about PHP filter and why it should be used?

882


Which are the best start and end tags to use?

953


Explain what is the difference between session and cookie?

971


How to remove a file?

1061


In PHP, fgets() is used to read a file one line at a time. State Whether True or False?

1129


What is difference between explode() or split() in PHP?

899


How to write in a file in php?

945