fn check_php_version(info: &PHPInfo) -> Result<()> {
    const PHP_81_API_VER: u32 = 2021_09_02;
    const PHP_82_API_VER: u32 = 2022_08_29;
    const PHP_83_API_VER: u32 = 2023_08_31;
    const PHP_84_API_VER: u32 = 2024_09_24;

    let version = info.zend_version()?;

    if !(MIN_PHP_API_VER..=MAX_PHP_API_VER).contains(&version) {
        bail!("The current version of PHP is not supported. Current PHP API version: {}, requires a version between {} and {}", version, MIN_PHP_API_VER, MAX_PHP_API_VER);
    }

    // Infra cfg flags - use these for things that change in the Zend API that don't
    // rely on a feature and the crate user won't care about (e.g. struct field
    // changes). Use a feature flag for an actual feature (e.g. enums being
    // introduced in PHP 8.1).
    //
    // PHP 8.0 is the baseline - no feature flags will be introduced here.
    //
    // The PHP version cfg flags should also stack - if you compile on PHP 8.2 you
    // should get both the `php81` and `php82` flags.
    println!(
        "cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php84, php_zts, php_debug, docs)"
    );
    println!("cargo:rustc-cfg=php80");

    if (MIN_PHP_API_VER..PHP_81_API_VER).contains(&version) {
        println!("cargo:warning=PHP version 8.0 is EOL and will no longer be supported in a future release. Please upgrade to a supported version of PHP. See https://www.php.net/supported-versions.php for information on version support timelines.");
    }

    if version >= PHP_81_API_VER {
        println!("cargo:rustc-cfg=php81");
    }

    if version >= PHP_82_API_VER {
        println!("cargo:rustc-cfg=php82");
    }

    if version >= PHP_83_API_VER {
        println!("cargo:rustc-cfg=php83");
    }

    if version >= PHP_84_API_VER {
        println!("cargo:rustc-cfg=php84");
    }

    Ok(())
}
Checks the PHP Zend API version for compatibility with ext-php-rs, setting
any configuration flags required.
build.rs