code: function checkPhpExtensionVersion($extensionName, $version, $compare = '>=')
      {
          if (!extension_loaded($extensionName)) {
              return false;
          }
          $extensionVersion = phpversion($extensionName);
          if (empty($extensionVersion)) {
              return false;
          }
          if (strncasecmp($extensionVersion, 'PECL-', 5) === 0) {
              $extensionVersion = substr($extensionVersion, 5);
          }
  
          return version_compare($extensionVersion, $version, $compare);
      }
docs: Checks if the given PHP extension is available and its version matches the given one.
  @param string $extensionName PHP extension name.
  @param string $version required PHP extension version.
  @param string $compare comparison operator, by default '>='
  @return bool if PHP extension version matches.