• PHP Video Tutorials

PHP - Function Str Replace



Syntax

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

Definition and Usage

It is used to replace the string with another string.

Return Values

It returns the string or array with replaced value

Parameters

Sr.No Parameters & Description
1

find

It specifies the string to find

2

replace

It specifies the replace the value in find

3

string

It specifies the string to be searched

4

count

It used to count the number of replaced variable

Example

Try out the following example

<?php
   echo str_replace("park","point","tutorials park");
?>

This will produce following result −

tutorials point
php_function_reference.htm
Advertisements