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 are different types of errors available in Php?

974


What are the main error types in php and how do they differ?

1369


Can you use both this () and super () in a constructor?

1056


Explain what is the difference between for and foreach?

1118


Can we use include ("xyz.php") two times in a php page "index.php"?

1068


Is empty function c++?

1005


Tell me can the value of a constant change during the script's execution?

1388


Do you know how can we check the value of a given variable is a number?

971


Which methods should be used for sending an email using the variables $to, $subject, and $body?

1204


What are php libraries?

975


Explain scalar type declarations in php7?

1011


Distinguish between urlencode and urldecode?

1047


What is array and function?

1097


Can we extend multiple classes in php?

1088


What is use of isset function in php?

1101