<?php class Test { public function __destruct() { echo "Object is destroyed"; } } $obj = new Test(); unset($obj); // خروجی: Object is destroyed ?>