Input
Output
<?php class User { public $name; function __construct($name) { $this->name = $name; echo "User '$name' created.<br>"; } function __destruct() { echo "User '$this->name' destroyed.<br>"; } } $user1 = new User("Alice"); $user2 = new User("Bob"); echo "Script continues...<br>"; // Destructors will be called automatically at the end ?>