/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/helpers/utf8/substr_replace.php
22 строки
644 B
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php use common\helpers\Utf8Helper; /** * Utf8Helper::substr_replace */ function _substr_replace($str, $replacement, $offset, $length = null) { if (Utf8Helper::isAscii($str)) { return ($length === null) ? substr_replace($str, $replacement, $offset) : substr_replace($str, $replacement, $offset, $length); } $length = ($length === null) ? Utf8Helper::strlen($str) : (int)$length; preg_match_all('/./us', $str, $str_array); preg_match_all('/./us', $replacement, $replacement_array); array_splice($str_array[0], $offset, $length, $replacement_array[0]); return implode('', $str_array[0]); }