[php-src] Issue #13660: Object dependency without inheritance
| From: | zboszor | Date: | Sun, 10 Mar 2024 09:15:43 +0000 |
| Subject: | [php-src] Issue #13660: Object dependency without inheritance | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246557@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13660
Author: zboszor
### Description
My issue is rather a question and not a feature request.
Is it possible for a PHP module written in C to establish dependency between objects that are not
child and parent in the inheritance sense?
The idea is that
class A has a method A::new_B() that returns an object of
class A\B. E.g.:
```
$a = new A();
$b = $a->new_B();
```
Internally, $b would be associated with $a so unset $a; would
automatically destroy $b.
Is this possible in a PHP module written in C?