Home  >  Article  >  Backend Development  >  If a PHP expert wants to replace multiple keywords in str_replace, how should he write the first parameter?

If a PHP expert wants to replace multiple keywords in str_replace, how should he write the first parameter?

WBOY
WBOYOriginal
2016-12-01 01:27:481534browse

str_replace(find,replace,string,count)
How to write if find is several keywords

Reply content:

str_replace(find,replace,string,count)
How to write if find is several keywords

<code>str_replace(['a','b','c'],'a',$str);//a或b或c都替换成a
str_replace(['a','b','c'],['d','e','f'],$str);//a->d b->e c->f</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn