从父函数的父类调用函数

Let's say, for simplicity, this is how my page is set up:

class TFS extends PHP_db
{
    public function execute() {
        class Dostuff {
            public static function doit() {
                return "wee";
            }
        }
    Now here I can use Dostuff:doit() successfully
    And also $this->db->functionhere() which is from the PHP_db is also successful from here

    }
}

I need to figure how to call $this->db->functionhere() from within the doit() function inside the Dostuff class..

I have already tried this in the Dostuff class:

protected $parent_object;
public function __construct( $object ) {
    $this->parent_object = $object;
 }

and this from the execute() function: $dostuffclass = new Dostuff($this);

But then when I try to use $parent_object->db->functionhere() it doesn't work, telling me it's not an object.

You could pass the $this context to the internal DoStuff class as a parameter, for example:

class TFS extends PHP_db
{
    public function execute() {
        class Dostuff {
            public static function doit($somevar) {
                $somevar->functionhere();
                ^^^^ <-- add this
                return "wee";
            }
        }
    }
}

The internal class DoStuff does not need to know anything about the $this context you are referring to, since you are sending a reference to an existing class instance to it as a parameter.