Menu Riverview Church

STR_REPLACE

Replace all occurrences of the search string with the replacement string

SYNTAX

str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) : mixed

PARAMETERS

search

The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.

replace

The replacement value that replaces found search values. An array may be used to designate multiple replacements.

subject

The string or array being searched and replaced on, otherwise known as the haystack. If subject is an array, then the search and replace is performed with every entry of subject, and the return value is an array as well.

count

If passed, this will be set to the number of replacements performed.

RETURN

This function returns a string or an array with the replaced values.

EXAMPLES

SEARCH REPLACE SUBJECT

replace Case CASE

COUNT

1

1

replace replace replace

2

replace1 replace2 replace3

3

line<br>line<br>line<br>line

4

f

4

apearpearle pear

PHP