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 6829217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:28:28+00:00 2026-05-26T22:28:28+00:00

A and B have function with the same signature — let’s assume : foo($arg)

  • 0

A and B have function with the same signature — let’s assume : foo($arg) — and that class A extends B.

Now I have an instance:

$a = new A();

$a.foo($data);

Can I also run the parent’s (B’s) foo() function through $a or was it overridden?

Thanks!
Nimi

  • 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-26T22:28:30+00:00Added an answer on May 26, 2026 at 10:28 pm

    It is overridden but if you want to use both you can do this:

    function parentFoo($arg)
    {
        return parent::foo($arg);
    }
    

    If you want that the child function calls the parent function do this:

    function foo($arg)
    {
        $result = parent::foo($arg);
        // Do whatever you want
    }
    

    See this URL for more information: http://php.net/manual/en/keyword.parent.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume that I have a boost::function of with an arbitrary signature called type CallbackType
I have two buttons which call the same function. That functions signature is -
I have a function with the same name, but with different signature in a
I want to make sure that a set of functions have the same signature
I have a couple of functions inside a class that essentially do the same
I have a function getA() with the following signature: class A { public: typedef
I have to create a photo gallery app in iPhone. It should function same
The problem seems very strange. I have a AJAX helper function within a same
Can you use the bash getopts function twice in the same script? I have
I have two functions that have different enough logic but pretty much the same

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.