function create_word(string $alphabet, int $index): string
{
$base = mb_strlen($alphabet);
$fix = 1;
$length = 1;
foreach (range(1, $base) as $k) {
$pow = pow($base, $k);
if ($fix + $pow <= $index) {
$fix += $pow;
$length++;
} else {
break;
}
}
$template = sprintf("%0{$length}d", base_convert($index - $fix, 10, $base));
$replace = implode('', range(0, $base));
return strtr($template, $replace, $alphabet);
}
for ($i = 1; $i <= 81; $i++) {
echo $i . ' = '. create_word("abc", $i) . \PHP_EOL;
}
class UserProvider implements UserProviderInterface
{
public function loadUserByUsername($username)
{
return new User();
}
public function refreshUser(UserInterface $user)
{
return new User();
}
public function supportsClass($class)
{
return $class === User::class;
}
}
IS_AUTHENTICATED_FULLY: This is similar to IS_AUTHENTICATED_REMEMBERED, but stronger. Users who are logged in only because of a "remember me cookie" will have IS_AUTHENTICATED_REMEMBERED but will not have IS_AUTHENTICATED_FULLY.
IS_AUTHENTICATED_FULLY
нужна для проверки прав на критичных страницах, типа смены пароля
A non-numeric value encountered
и в итоге только один результат: