Is there a way to declare variables in classes that works in both PHP 5 and PHP 4?

In PHP 4, class properties were declared using the `var` keyword, while in PHP 5, the `public`, `protected`, or `private` keywords are used. To make code compatible with both PHP 4 and PHP 5, you can use the `var` keyword along with the `public` keyword. This way, the code will work in both versions of PHP.

class MyClass {
    var $variable; // Declaring the variable using var for PHP 4 compatibility

    public function __construct() {
        $this->variable = 'Hello World';
    }
}

$obj = new MyClass();
echo $obj->variable;