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

$a=10;
$b=10;
list($a,$b) = array($b, $a);
echo "a=" . $a;
echo "b=" . $b;

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between the functions strstr() and stristr()?

1037


What is the use of htmlentities in php?

1041


What is form validation in php?

1072


Php says that an array is an ordered map. But how the values are ordered in an array?

1104


What is cookies php?

1024


What is the difference between abstract class and interface in php?

1222


what is the current salary package in India for a PHP programmer who has 1.5 years experience

3036


What is a static method php?

1049


Should I use mysqli or pdo?

1002


What is the difference between htmlentities() and htmlspecialchars()?

1052


What is xss in php?

1053


What is die in php?

1106


What is empty php?

1030


Is php developer in demand?

1015


How many types of array supported in php?

1036