How does PHP 5 handle backwards compatibility with scripts written in PHP 4?

PHP 5 maintains a high level of backwards compatibility with scripts written in PHP 4 by providing support for most PHP 4 code. However, there are some deprecated features in PHP 4 that may cause compatibility issues in PHP 5. To address this, developers can use the "compatibility mode" in PHP 5 to emulate PHP 4 behavior.

// Enable compatibility mode in PHP 5
if (version_compare(PHP_VERSION, '5.0.0', '>=')) {
    ini_set('zend.ze1_compatibility_mode', 1);
}