Revert "Minor adjustments #572"

This reverts commit 90d1fc4236.
This commit is contained in:
Roman Kelesidis 2023-03-08 11:46:03 +07:00
commit 903a2ced32
3 changed files with 31 additions and 15 deletions

View file

@ -349,19 +349,13 @@ function str_compact($str)
return preg_replace('#\s+#u', ' ', trim($str));
}
/**
* Generate a "random" alphanumeric string.
*
* Should not be considered sufficient for cryptography, etc.
*
* @param int|string $length
* @return string
*/
function make_rand_str($length = 10): string
function make_rand_str($len = 10)
{
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
return substr(str_shuffle(str_repeat($pool, (int)$length)), 0, $length);
$str = '';
while (strlen($str) < $len) {
$str .= str_shuffle(preg_replace('#[^0-9a-zA-Z]#', '', password_hash(uniqid(mt_rand(), true), PASSWORD_BCRYPT)));
}
return substr($str, 0, $len);
}
function array_deep(&$var, $fn, $one_dimensional = false, $array_only = false)