如何将子实例转换为父类,反之亦然?

$child_instance = (childClass)$parent_instance;
$parent_instance = (parentClass)$child_instance;

Or is it possible?

No. After you use new ClassA you cannot change the type of class the class of that object.

Okay, I am pretty new to OOP in PHP too, and hence, had spent like an hour to look for a way to convert a child class instance to a parent class instance.

Alas, found it!

In your child class, just have this method:

function loadChildWithParent($instanceOfParent) {
        $props = get_object_vars($instanceOfParent);
        foreach ($props as $key => $val)
        {
            $this->$key = $val;
        }
}

And in your parent class, you can just call this method via:

$objNew = new student();
$objNew->voidLoadStudent($this);