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

What is faster in php?

1010


what does this symbol mean in php?

1087


What is the use of header in php?

928


What are the differences between session and cookie?

955


How do you parse and process html/xml in php?

964


How to include a file code in different files in php?

1032


Which is the dependent variable?

861


Explain Booleans in PHP?

1042


List some of the features of php7.

957


Is php a case sensitive language?

1111


How do you pass a variable by value in php?

947


What is api example?

933


Explain which cryptographic extension provide generation and verification of digital signatures?

949


How we load all classes that placed in different directory in one php file , means how to do auto load classes.

938


How do you explain independent and dependent variables?

851