HH\Lib\Str\replace
Requires the Hack Standard Library to be installed.
Facebook Engineer?
This function is available as Str\replace()
in Facebook's www repository.
Returns the "haystack" string with all occurrences of $needle
replaced by
$replacement
namespace HH\Lib\Str;
function replace(
string $haystack,
string $needle,
string $replacement,
): string;
- For a case-insensitive search/replace, see
Str\replace_ci()
. - For multiple case-sensitive searches/replacements, see
Str\replace_every()
. - For multiple case-insensitive searches/replacements, see
Str\replace_every_ci()
.
Parameters
string $haystack
string $needle
string $replacement
Returns
string