Supported Versions: PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8
Compares two "PHP-standardized" version number strings
<?php version_compare(string $version1, string $version2, ?string $operator = null): int|bool
<?php $version = $config['version'] ?? $connection->getAttribute(PDO::ATTR_SERVER_VERSION);
if (version_compare($version, '8.0.11') >= 0) {
return 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
}
<?php {
$version = $query->getConnection()->getServerVersion();
return ! $query->getConnection()->isMaria() && version_compare($version, '8.0.11') < 0;
}
<?php {
$version = $query->getConnection()->getServerVersion();
if (version_compare($version, '3.25.0') >= 0) {
return parent::compileGroupLimit($query);
}
<?php public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection)
{
if (version_compare($connection->getServerVersion(), '10.5.2', '<')) {
return $this->compileLegacyRenameColumn($blueprint, $command, $connection);
}
<?php {
$version = $connection->getServerVersion();
if (($connection->isMaria() && version_compare($version, '10.5.2', '<')) ||
(! $connection->isMaria() && version_compare($version, '8.0.3', '<'))) {
return $this->compileLegacyRenameColumn($blueprint, $command, $connection);
}
<?php $version = $connection->getServerVersion();
if (($connection->isMaria() && version_compare($version, '10.5.2', '<')) ||
(! $connection->isMaria() && version_compare($version, '8.0.3', '<'))) {
return $this->compileLegacyRenameColumn($blueprint, $command, $connection);
}
<?php .'(select tc.collcollate from pg_catalog.pg_collation tc where tc.oid = a.attcollation) as collation, '
.'not a.attnotnull as nullable, '
.'(select pg_get_expr(adbin, adrelid) from pg_attrdef where c.oid = pg_attrdef.adrelid and pg_attrdef.adnum = a.attnum) as default, '
.(version_compare($this->connection?->getServerVersion(), '12.0', '<') ? "'' as generated, " : 'a.attgenerated as generated, ')
.'col_description(c.oid, a.attnum) as comment '
.'from pg_attribute a, pg_class c, pg_type t, pg_namespace n '
.'where c.relname = %s and n.nspname = %s and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and n.oid = c.relnamespace '
<?php $databaseVersion = Str::before($databaseVersion, '-');
}
if (($databaseEngine === 'mysql' && version_compare($databaseVersion, '8.0.1', '>=')) ||
($databaseEngine === 'mariadb' && version_compare($databaseVersion, '10.6.0', '>=')) ||
($databaseEngine === 'pgsql' && version_compare($databaseVersion, '9.5', '>=')) ||
($databaseEngine === 'vitess' && version_compare($databaseVersion, '19.0', '>='))) {
<?php }
if (($databaseEngine === 'mysql' && version_compare($databaseVersion, '8.0.1', '>=')) ||
($databaseEngine === 'mariadb' && version_compare($databaseVersion, '10.6.0', '>=')) ||
($databaseEngine === 'pgsql' && version_compare($databaseVersion, '9.5', '>=')) ||
($databaseEngine === 'vitess' && version_compare($databaseVersion, '19.0', '>='))) {
return 'FOR UPDATE SKIP LOCKED';
<?php if (($databaseEngine === 'mysql' && version_compare($databaseVersion, '8.0.1', '>=')) ||
($databaseEngine === 'mariadb' && version_compare($databaseVersion, '10.6.0', '>=')) ||
($databaseEngine === 'pgsql' && version_compare($databaseVersion, '9.5', '>=')) ||
($databaseEngine === 'vitess' && version_compare($databaseVersion, '19.0', '>='))) {
return 'FOR UPDATE SKIP LOCKED';
}
<?php if (($databaseEngine === 'mysql' && version_compare($databaseVersion, '8.0.1', '>=')) ||
($databaseEngine === 'mariadb' && version_compare($databaseVersion, '10.6.0', '>=')) ||
($databaseEngine === 'pgsql' && version_compare($databaseVersion, '9.5', '>=')) ||
($databaseEngine === 'vitess' && version_compare($databaseVersion, '19.0', '>='))) {
return 'FOR UPDATE SKIP LOCKED';
}
<?php {
$phpredisVersion = phpversion('redis');
return $phpredisVersion !== false && version_compare($phpredisVersion, $version, '>=');
}
}
<?php Arr::get($config, 'retry_interval', 0),
];
if (version_compare(phpversion('redis'), '3.1.3', '>=')) {
$parameters[] = Arr::get($config, 'read_timeout', 0.0);
}
<?php $parameters[] = Arr::get($config, 'read_timeout', 0.0);
}
if (version_compare(phpversion('redis'), '5.3.0', '>=') && ! is_null($context = Arr::get($config, 'context'))) {
$parameters[] = $context;
}
<?php isset($options['persistent']) && $options['persistent'],
];
if (version_compare(phpversion('redis'), '4.3.0', '>=')) {
$parameters[] = $options['password'] ?? null;
}