What are the differences in using classes in PHP 4 compared to PHP 5?

In PHP 4, classes were defined using the "class" keyword without the visibility keywords like "public", "private", or "protected". In PHP 5, visibility keywords were introduced to specify the access level of properties and methods within a class. This allows for better encapsulation and control over class members.

// PHP 4 class definition
class MyClass {
    var $property;

    function myMethod() {
        // method implementation
    }
}

// PHP 5 class definition
class MyClass {
    public $property;

    public function myMethod() {
        // method implementation
    }
}