I'm quite inexperienced with OOP.
I'm creating an MVC framework as an exercise. I would like to be able to autoload external classes into properties of the main controller (based on specific settings). To make this question more simple, how can I add properties/methods from outside a class?
I have this class:
class Controller {
public $property = array();
public function getProperty() {
return $this->property;
}
}
I would like to add a property (i.e: $second_property) from outside the class, without having to create an instance. Is it possible with PHP 8?