Новый файл helpers
This commit is contained in:
16
src/helpers.php
Normal file
16
src/helpers.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('valid_strlen')) {
|
||||
/**
|
||||
* Возвращает корректную длину строки
|
||||
*
|
||||
* @param string $value
|
||||
* @return int
|
||||
*/
|
||||
function valid_strlen(string $value): int
|
||||
{
|
||||
return function_exists('mb_strlen')
|
||||
? mb_strlen($value)
|
||||
: strlen($value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user