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 the benefits of composer?

1011


What is difference between print and echo in php?

928


How to get the directory name out of a file path name?

956


How to set cookies?

1011


With a heredoc syntax, do I get variable substitution inside the heredoc contents?

1091


Which is useful for method overloading?

1142


How to get length of an array in PHP?

1027


What function should you use to join array elements with a glue string?

980


How to create a table to store files?

1106


What is use of header() function in php? What the limitation of header()?

972


What is member function?

1041


Tell us how can we access the data sent through the url with the post method?

998


Write down the code for save an uploaded file in php.

979


What is array and function?

1059


Which is variable cost?

974