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

$a = 10;
$b = 20;

echo $a, $b;
echo "<br>";
swap($a, $b);
echo $a, $b;
function swap(&$a, &$b)
{
$temp = $a;
$a = $b;
$b = $temp;
}

Is This Answer Correct ?    80 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to find the index of an element in an array php?

1011


Are php session secure?

1052


What is a php trait?

950


What is php session id?

993


Is empty function c++?

971


What does $this do in php?

971


Tell me how to get the value of current session id?

948


Explain object-oriented methodology in php?

1007


What is reference variable php?

1034


Which php framework is best for beginners?

1115


How to remove values saved in the current session?

1050


Can the value of a constant change during the script's execution?

982


How to set session.gc_divisor properly?

1059


What are super global variables in php?

1043


How to include variables in double-quoted strings in php?

973