<?php
function convertVersionId($versionId, $base)
{
return sprintf(
'%d.%d.%d',
$versionId / ($base * $base),
($versionId / $base) % $base,
$versionId % $base
);
}
function convertVersionIdFixed($versionId, $base)
{
return sprintf(
'%d.%d.%d',
$versionId / ($base * $base),
(int) ($versionId / $base) % $base,
$versionId % $base
);
}
var_dump(convertVersionId(30411, 100));
var_dump(convertVersionId(20449, 100));
echo '-----------', PHP_EOL;
var_dump(convertVersionIdFixed(30411, 100));
var_dump(convertVersionIdFixed(20449, 100));
preferences:
29.09 ms | 405 KiB | 5 Q