tryphp_destructor2.php:
name = $name; $this->color = $color; } function __destruct() { echo "The fruit is {$this->name} and the color is {$this->color}."; } } $apple = new Fruit("Apple", "red"); ?>
The fruit is Apple and the color is red.