What is the meaning of the method name in the class file preceded by A & symbol

Source: Internet
Author: User
What do you mean by adding a & symbol to the method name in the class file?
class Foo {
public $value = 42;

Public Function &getvalue () {
return $this->value;
}
}
What does the pre-GetValue & symbol in the above code mean? What role does it have?
------to solve the idea----------------------
$var = GetValue ();
$var = &getvalue ();

The difference between the two, you look at it.
------to solve the idea----------------------
A leading & representation can return a reference

If the e_strict level error check is not turned on, then there are no identical. Otherwise, it will produce
Strict Standards: Only variables should is assigned by reference
$p = new Foo;
echo $n =& $p->getvalue ();
$n + +;
echo $p->getvalue ();

------to solve the idea----------------------
The name of the function is replaced by a variable, here can be understood as a reference, I answer the question is never a metaphor, do not bend the corner, let you lung solution.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.