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

function swap(){

$a = 10;
$b = 20;

$a = $a + $b;
$b = $a - $b;
$a = $a - $b;
echo $a, $b;

}

Is This Answer Correct ?    45 Yes 25 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is PHP? Who is the father or inventor of PHP?

991


Can php variables have numbers?

950


Is there an easy way to delete an element from a php array?

877


What are the difference between echo and print?

934


What are the design patterns in php?

937


What is the difference between array_pop() and array_push()?

1120


Differentiate between require and include?

922


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

984


What is artisan in php?

900


Write the statements that are used to connect php with mysql

920


When is a conditional statement ended with endif?

908


Do I need apache for php?

1019


Where session is stored?

938


Is php a low level language?

922


What is good average session duration?

960