PHPStringstr_replace

Replace all occurrences of the search string with the replacement string.

Syntax

str_replace(array|string $search, array|string $replace, string $subject): string

Example

Enter values below to update the example in real time.

echo
str_replace
Hello
PHP
echo str_replace("World", "PHP", "Hello World"); // Hello PHP