Is it common practice to create objects of a class within the constructor of other classes in PHP?

It is common practice to create objects of a class within the constructor of other classes in PHP. This is often done to establish relationships between classes and to initialize necessary dependencies. By creating objects within the constructor, you can ensure that the necessary objects are available for use when the class is instantiated.

class ClassA {
    public function __construct() {
        $this->objB = new ClassB();
    }
}

class ClassB {
    // ClassB implementation
}

$objA = new ClassA();