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 / sangita jain

<?php function swap(){
$a=10;
$b=20;
$b=$b-$a;
$a=$a+$b;
echo $a,$b;
}

swap();

?>

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does the scope of variables mean?

908


What is the difference between echo print and print_r in php?

941


What is different between software and app

1708


What is the difference between static and dynamic websites?

944


What is c++ polymorphism?

929


How do I stop a php script?

933


How can we create a database using php?

1076


Explain the difference between urlencode and urldecode?

1012


What are the encryption functions in php?

1086


How do you call a constructor for a parent class?

864


How to connect to mysql from a php script?

1012


Tell me how is the ternary conditional operator used in php?

1033


Tell me how to initiate a session in php?

1073


What is the difference between get and post in php?

995


Why is php so popular?

880