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 factory pattern in php?

923


Tell us what is the difference between session_unregister() and session_unset()?

998


Why framework is used in php?

985


How can we check the value of a given variable is alphanumeric?

983


Which php framework is best for beginners?

1101


Is echo a function in php?

992


What is php destruct?

958


What is http php?

949


What are sql injections, how do you prevent them and what are the best practices?

1058


How do you destroy a particular or all Sessions?

994


What the limitation of header() function in php?

956


What is $_ request in php?

890


How to specify argument default values?

973


How to get the number of characters in a string?

1021


What is csrf validation?

1089