in src/str/utf8/transform.php [146:161]
function splice(
string $string,
string $replacement,
int $offset,
?int $length = null,
)[rx_local]: string {
invariant($length === null || $length >= 0, 'Expected non-negative length.');
$total_length = length($string);
$offset = _Private\validate_offset($offset, $total_length);
if ($length === null || ($offset + $length) >= $total_length) {
return slice($string, 0, $offset).$replacement;
}
return slice($string, 0, $offset).
$replacement.
slice($string, $offset + $length);
}