Recently developed Zen Cart some questions want to consult under

Source: Internet
Author: User
Tags zen cart
Recently developed Zen Cart some questions want to inquire!
Recently doing something with Zen Cart Mall system! See a bit of code!
function Notify ($eventID, $paramArray = Array ()) {
$observers = &Base::getstaticobserver ();
if (!is_null ($observers))
{
foreach ($observers as $key = = $obs) {
if ($obs [' eventID '] = = $eventID) {
$obs [' Obs ']->update ($this, $eventID, $paramArray);
}
}
}
}

function &Getstaticobserver () {
return Base::getstaticproperty (' Observer ');
}
What does A & mean after each function in a class?
The meaning of Base::getstaticobserver () should be a way of representing a class! Is it a quote to add a & in front?
Why do I add a & when I define a method
Ask the great God to explain in detail!

Share to:


------Solution--------------------
& References

The first point is that a reference is obtained
The second place indicates that the method will return a reference

Finally, the $observers is base:: $observer Reference
Any modification to the $observers will affect base:: $observer
This in turn affects all uses of base:: $observer behavior

If base:: $observer is not used for scheduling, it is not advisable to use this notation.
Of course, even if base:: $observer applies To scheduling, it is not recommended. It's too vague.
  • 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.