| 1 | <?php |
| 2 | |
| 3 | abstract class Destructable { |
| 4 | protected function mem_flush() { |
| 5 | foreach (func_get_args() as $key) { |
| 6 | if ($this->$key) { |
| 7 | if (is_object($this->$key)) { |
| 8 | $this->$key->__destruct(); |
| 9 | } |
| 10 | elseif (is_array($this->$key)) { |
| 11 | foreach ($this->$key as $loc => $value) { |
| 12 | if (is_object($value)) { |
| 13 | $value->__destruct(); |
| 14 | } |
| 15 | } |
| 16 | } |
| 17 | unset($this->$key); |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | } |