replaceOnce()
replaceOnce(string $pattern, string $replacement, string $string) : string
Convenient function that behave exactly like str_replace for the first occurrence only.
Parameters
string | $pattern | the pattern to be replaced |
string | $replacement | the string to replace the first matched pattern |
string | $string | the string to search the pattern into |
Returns
string —the new string with the first matched pattern replaced