igfs/kernel/helpers/Version.php

16 lines
363 B
PHP
Raw Normal View History

2024-12-19 12:53:55 +03:00
<?php
namespace kernel\helpers;
class Version
{
public static function getIntVersionByString(string $version): int
{
$version = preg_replace('/[^0-9]+/', '', $version);
return match (strlen($version)) {
1 => intval($version) * 100,
2 => intval($version) * 10,
3 => intval($version),
};
}
}