What are some alternative solutions to the lack of multiple inheritance in PHP, especially when extending classes like SimpleXMLElement?

When extending classes like SimpleXMLElement in PHP, the lack of multiple inheritance can be a limitation. One alternative solution is to use composition over inheritance by creating a wrapper class that contains an instance of SimpleXMLElement and delegates calls to it. Another approach is to use interfaces to define common behavior that can be implemented by multiple classes, allowing for a form of multiple inheritance through interface implementation.

class SimpleXMLElementWrapper {
    private $element;

    public function __construct(SimpleXMLElement $element) {
        $this->element = $element;
    }

    public function __call($method, $args) {
        return call_user_func_array([$this->element, $method], $args);
    }
}

// Example usage
$element = new SimpleXMLElement('<root><child>Hello</child></root>');
$wrapper = new SimpleXMLElementWrapper($element);
echo $wrapper->asXML();