Return the string with a slice specified by the offset/length replaced by the given replacement string

namespace HH\Lib\Str;

function splice_l(
  \HH\Lib\Locale\Locale $locale,
  string $string,
  string $replacement,
  int $offset,
  ?int $length = NULL,
): string;

If the length is omitted or exceeds the upper bound of the string, the remainder of the string will be replaced. If the length is zero, the replacement will be inserted at the offset.


  • \HH\Lib\Locale\Locale $locale
  • string $string
  • string $replacement
  • int $offset
  • ?int $length = NULL


  • string