What are the best practices for addressing PHP function compatibility issues with GD library versions in web development projects?

When working on web development projects that involve image processing using the GD library in PHP, compatibility issues may arise due to different versions of the GD library. To address this, it is recommended to check for the availability of specific GD functions before using them in your code. This can be achieved by using the function_exists() function to ensure that the required functions are supported by the GD library version being used.

if (function_exists('imagecreatefromjpeg')) {
    // GD function imagecreatefromjpeg() is available
    $image = imagecreatefromjpeg('image.jpg');
} else {
    // GD function imagecreatefromjpeg() is not available
    // Handle the compatibility issue here
}