is_php_version_compatible

The timeline below displays how wordpress function is_php_version_compatible has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Checks compatibility with the current PHP version.
 *
 * @since 5.2.0
 *
 * @param string $required Minimum required PHP version.
 * @return bool True if required version is compatible or empty, false if not.
 */
function is_php_version_compatible($required)
{
    return empty($required) || version_compare(PHP_VERSION, $required, '>=');
}

WordPress Version: 5.2

/**
 * Checks compatibility with the current PHP version.
 *
 * @since 5.2.0
 *
 * @param string $required Minimum required PHP version.
 * @return bool True if required version is compatible or empty, false if not.
 */
function is_php_version_compatible($required)
{
    return empty($required) || version_compare(phpversion(), $required, '>=');
}