HH\Lib\Str\splice
Requires the Hack Standard Library to be installed.
Facebook Engineer?
This function is available as Str\splice()
in Facebook's www repository.
Return the string with a slice specified by the offset/length replaced by the given replacement string
namespace HH\Lib\Str;
function splice(
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.
Previously known in PHP as substr_replace
.
Parameters
string $string
string $replacement
int $offset
?int $length = NULL
Returns
string