Thursday, December 25, 2008

PHP: Function to replace pattern of characters in a String

The functions str_replace is used to replace particular sequence of characters in a string.
Usage

str_replace(find,replace,str)
here
find --> sequence of characters to be replaced
replace --> sequence of characters with which it is to be replaced
str --> the string inwhich modifications must be done.

example

str_replace("ad","br","google ads");

the out put will be

google brs

0 comments: