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

  • SEARCH
  • Home
  • 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 8565753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:30:01+00:00 2026-06-11T17:30:01+00:00

I understand how to create a class, instantiate it, as well as access properties

  • 0

I understand how to create a class, instantiate it, as well as access properties and methods, but $myobject->function() is about as complicated as it gets for me for now.

What is this structure?

$myobject->function()->something. I am repeatedly seeing this more and more, especially as I start wrapping my head around PDO queries. For example:

$query->function1($arg)
  ->function2($arg)
  ->function3($arg);

What’s happening here? is it simply chaining one call of multiple methods in the class, or are those sub-functions of function1()? What would the class definition look like?

  • 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-06-11T17:30:02+00:00Added an answer on June 11, 2026 at 5:30 pm

    $myobject->function() is returning an object, ->something would access a field on that object.

    Basically, the main concept in this programming method is that an object contains data and methods (or “functions”) to interact with the contained data. These containers can be conveniently passed around. PHP is giving you some shorthand so you don’t have to assign everything to a variable.

    Returning objects is a way to layer functionality, so your PDO object, which has a query method, may return a row object. The row object has its own set of methods (e.g. for getting column values), so you can then invoke those methods.

    So:

    $pdo->queryOneRow(...)->getValue(<some column>)
    

    Is really just shorthand for:

    $result = $pdo->queryOneRow(...);
    $result->getValue(<some column>)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've installed UML plugin but I cant understand how create UML automatically
I understand that I can call ToString().IndexOf(...), but I don't want to create an
I get this SoapFault I dont understand. Calling the function below, codewordStemExists(), should create
I am trying to create a class in C++ and be able to access
I have learned that we can't instantiate an abstract class. But today i tested
Assume I have some class in my project. Now I create another Class library
I understand that CoCreateInstance finds the COM server for the given class id, creates
I understand I can create an enum like this: public enum MyEnum { ONE(1),
I understand how to create a virtualenv, activate that virtualenv, and then install django
I need to understand how to create a simple animation in HTML 5 or

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.