What are the key differences between PHP 4.x and PHP 5 that developers should be aware of?

One key difference between PHP 4.x and PHP 5 is the introduction of new object-oriented features in PHP 5, such as visibility keywords (public, private, protected) and magic methods (__construct, __destruct, __get, __set). Another important difference is the improved error handling in PHP 5, with the introduction of exceptions. Developers should be aware of these changes when upgrading their code from PHP 4.x to PHP 5.

// PHP 4.x code
class MyClass {
    function MyClass() {
        // constructor logic
    }
}

// PHP 5 code
class MyClass {
    public function __construct() {
        // constructor logic
    }
}