How can one test the functionality of a destructor in PHP without access to a development environment like XAMPP?

To test the functionality of a destructor in PHP without access to a development environment like XAMPP, you can use online PHP sandbox tools such as phpfiddle.org or phptester.net. These tools allow you to write and execute PHP code directly in a web browser without the need for a local development environment.

<?php

class MyClass {
    public function __construct() {
        echo "Constructor called\n";
    }

    public function __destruct() {
        echo "Destructor called\n";
    }
}

// Create an instance of MyClass
$obj = new MyClass();

// Output will show the constructor and destructor being called