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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:38:15+00:00 2026-06-01T03:38:15+00:00

I am trying to access/change the properties of a class’ Parent through Reflection. If

  • 0

I am trying to access/change the properties of a class’ Parent through Reflection.

If I run ReflectionClass::getProperties() on the child, does it also return any properties that the Parent has as well?

If it doesn’t, is there any way to access the parent properties using Reflection?

  • 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-01T03:38:16+00:00Added an answer on June 1, 2026 at 3:38 am

    I worked up this quick test. It looks like private properties of the parent are hidden when you get the child classes’s properties. However, if you invoke getParentClass() then getProperties() you will have the missing set of private props.

    <?php
    class Ford { 
      private $model;
      protected $foo;
      public $bar;
    }
    
    class Car extends Ford {
      private $year;
    }
    
    $class = new ReflectionClass('Car');
    var_dump($class->getProperties()); // First chunk of output
    var_dump($class->getParentClass()->getProperties()); // Second chunk
    

    Output (notice the private prop Ford::model is missing):

    array(3) {
      [0]=>
      &object(ReflectionProperty)#2 (2) {
        ["name"]=>
        string(4) "year"
        ["class"]=>
        string(3) "Car"
      }
      [1]=>
      &object(ReflectionProperty)#3 (2) {
        ["name"]=>
        string(3) "foo"
        ["class"]=>
        string(4) "Ford"
      }
      [2]=>
      &object(ReflectionProperty)#4 (2) {
        ["name"]=>
        string(3) "bar"
        ["class"]=>
        string(4) "Ford"
      }
    }
    

    Second Chunk (contains all the properties of the Ford class):

    array(3) {
      [0]=>
      &object(ReflectionProperty)#3 (2) {
        ["name"]=>
        string(5) "model"
        ["class"]=>
        string(4) "Ford"
      }
      [1]=>
      &object(ReflectionProperty)#2 (2) {
        ["name"]=>
        string(3) "foo"
        ["class"]=>
        string(4) "Ford"
      }
      [2]=>
      &object(ReflectionProperty)#5 (2) {
        ["name"]=>
        string(3) "bar"
        ["class"]=>
        string(4) "Ford"
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to access and change a array from a different class file.
I'm encountering some troubles while trying to access some properties with parameters. Well, I
I am trying to figure out when and how does Windows update File Access
I'm trying to change the properties of various UIButton that I have declared as
Trying to access a Servlet from a button on HTML page //Html Page FORM
When trying to access the database, I am unable to access the column. I
Im trying to access the Magento customer session in another part of my website.
Im trying to access a Sql CE 2005 database on a windows mobile device
I am trying to access information on a website that uses frames. When I
I am trying to access all the data from database listOfFolder table folder and

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.