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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:08:03+00:00 2026-05-20T17:08:03+00:00

<?php class gdTemplateDB { […] function rewrite_dependencies($section, $id) { global $wpdb, $table_prefix; /*var_dump($this); die;*/

  • 0
<?php class gdTemplateDB {
        [...]
     function rewrite_dependencies($section, $id) {
        global $wpdb, $table_prefix;
        /*var_dump($this);
        die;*/
        **include($this->plugin_path.'code/t2/templates.php');**
        [...]
      }
?>

I’m digging through the code of a wordpress plugin called GD star rating.
There are two “magical” things that I cannot figure out why:

  1. The class above apparently has no parents, but when I var_dump the $this pointer, it turns out to be an instance of another class called GDStarRating, and GDStarRating also has no parents! And, you know that the $this pointer cannot be abitrarily reinstantiated. So I can’t understand why the $this pointer behaves like that.
  2. The function rewrite_dependencies is statically called from another class (gdTemplateDB::rewrite_dependencies, not $instance->rewrite_dependencies) called gdsrAdmFunc, and that class also doesn’t have any parent-child relationships with GdStarRating. But it works just fine.

Please let me know, what can possibly cause those “magic” things?

  • 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-20T17:08:03+00:00Added an answer on May 20, 2026 at 5:08 pm

    class a{
      function aa(){
        var_dump($this);
      }
    }
    
    class b{
      function bb(){
        a::aa();
      }
    }
    
    $ob = new b();
    $ob->bb();
    

    here a::aa() outputs

    object(b)#1 (0) {   // $this is instance of b
    }
    

    Here $this in class a is object of class b because,

    function aa of class a is called from function bb class b.

    function bb of class b is called from object of class b.

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

Sidebar

Related Questions

I have one PHP class thus: class DB extends mysqli{ public function __construct( {
Why PHP class does not return <h1>404</h1><p>Not found</p> ? class checkid{ public $title; public
Possible Duplicate: PHP class instantiation. To use or not to use the parentheses? I
I've got a php class that I create several instances for. I'd like to
I have a PHP class that creates a SQL query based on values entered
I've created a PHP class that envelopes filter_input functions to make our developer's life
Possible Duplicate: PHP pagination class are there any PHP/Class libraries that i can utilize
In my PHP class I have public $a; public $b; public $c; public $d;
I have a PHP class to encrypt and decrypt strings: $ralphabet = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,.:;?~@#\$%^&*()_+-=][}{><; $alphabet
Writing my first PHP Class and came across an issue, the following is my

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.