Question
How to pass variables by references?

Answers

You can pass a variable by reference to a function by taking the reference of the original variable, and passing that reference as the calling argument. Here is a PHP script on how to use pass variables by references:
function swap($a, $b) {
$t = $a;
$a = $b;
$b = $t;
}
$x = "PHP";
$y = "JSP";
print("Before swapping: $x, $y
");
swap(&$x, &$y);
print("After swapping: $x, $y
");
?>
This script will print:
Before swapping: PHP, JSP
After swapping: JSP, PHP
As you can see, the function modified the original variable.
Note that call-time pass-by-reference has been deprecated. You need to define arguments as references.   Your Comment




More Software Questions..
What is the inputsplit in map reduce software?

What is software configuration management?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?

What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?

Which oracle package is used to manage the oracle lock management services?

What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?

What is marker interface?

What types of partitioning are there for BW?



Search
Can you Answer!!
  • Q The first Asian to get a Nobel Prize for Economics?
  • Q Tell us about your Educational background?
  • Q Where you can find list of Silverlight Error Codes with Explanations?
  • Q Which is considered an encyclopedia of Indian Medicine?
  • Q The stool [Na] and [K] of a 36 year old woman with a history of diarrhea since the past 6 months are 10 mOsm/Kg H2O and 20 mOsm/Kg H2O respectively. Calculate the osmotic gap of stool and comment on it.
  • Q What is the primary objective of the quality review technique?
  • Q A male 20 years of age presents with unilateral nasal obstruction on right side. On examination there is a pale mass in right nostril which is seen hanging in the nasopharynx on posterior rhinoscopy. What is the most probable diagnosis?
  • Q A male fourteen years of age presents with recurrent epistaxis and right nasal obstruction for last six months. On examination there is a mass in the right nostril and nasopharynx, pinkish in colour, lobulated and bleeds on touch. What is the most probable diagnosis?
  • Q How do we create a thread to do ajax polling?
  • Q Are denial-of-service attacks also tested?
  • Q A line drawn on a map connecting points that receive equal amounts of rainfall is called ______?