Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6871369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:47:51+00:00 2026-05-27T03:47:51+00:00

How this stuff works? $object->foo1()->foo2()->foo3(); I’m working in Magento php framework. In Magento functions

  • 0

How this stuff works?

$object->foo1()->foo2()->foo3();

I’m working in Magento php framework. In Magento functions are called as sequence.But, I don’t understand how it works.Can anyone explain.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:47:52+00:00Added an answer on May 27, 2026 at 3:47 am
    $object->foo1()->foo2()->foo3();
    

    First, PHP will get a pointer to the foo1 method from the $object variable. It calls this method, which then returns another object. This second object (we shall call it $object2) has a method foo2(), which is also called. foo2() returns another object ($object3), which has a method foo3(), which returns whatever it likes.

    In some cases, $object, $object2 and $object3 are just pointers to the same object. This means that you can keep calling methods on the same class in a nice sequence.

    You can achieve this quite easily:

    class Foo
    {
        public function nicely()
        {
            return $this;
        }
    
        public function formatted()
        {
            return $this;
        }
    
        public function chained()
        {
            return $this;
        }
    
        public function calls()
        {
            return $this;
        }
    }
    
    $foo = new Foo();
    $foo->nicely()->formatted()->chained()->calls();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the an object called Response this works to trigger a function on .ready
In jQuery, I've done stuff like this in the past: $('#someCheckbox').click(); And everything works
if (preg_match('(\p{Nd}{4}/\p{Nd}{2}/\p{Nd}{2}/\p{L}+)', '2010/02/14/this-is-something')) { // do stuff } The above code works. However this
This is basic stuff, but I'm somewhat unfamiliar with VBA and the Word/Access object
I'm trying to work out how this Mock (using the Moq framework) stuff all
url(r'^video/?$','stuff.abc.views.video',name=video), This doesn't work: <a href={% url video %}>Videos</a> But this works: <a href=/video>Videos</a>
This is more of an exploratory question, seeing how the core JavaScript stuff works.
If I do this stuff.addEventListener(FooEvent.NAME, function(e:FooEvent) { dispatchEvent(e); } I get a runtime error
This is homework. Beginning Java class. Still wrapping my head around this stuff. The
I am a newbie in Quartz and I am fighting to understand this stuff

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.