What are some potential issues with using outdated versions of PHP and how can they be avoided?

Issue: Using outdated versions of PHP can expose your website to security vulnerabilities and compatibility issues with newer technologies. To avoid this, always keep your PHP version up to date with the latest stable release.

// Check for the PHP version and display a warning if it is outdated
if (version_compare(PHP_VERSION, '7.4.0') < 0) {
    echo "Warning: Your PHP version is outdated. Please upgrade to the latest version.";
}