How can developers receive warnings for deprecated features in PHP to prevent potential issues when changing PHP versions?

Developers can receive warnings for deprecated features in PHP by enabling error reporting and setting the `error_reporting` directive to include `E_DEPRECATED` and `E_USER_DEPRECATED`. This will display warnings for any deprecated features used in the code, helping developers identify and address them before changing PHP versions.

// Enable error reporting for deprecated features
error_reporting(E_ALL ^ E_NOTICE);