", $string);" regular method to replace strings with strings."/> ", $string);" regular method to replace strings with strings.">

Home  >  Article  >  Backend Development  >  How to replace string with regular string in php

How to replace string with regular string in php

藏色散人
藏色散人Original
2020-11-03 13:45:342157browse

php正则字符串替换字符串的方法:首先创建一个PHP示例文件;然后通过“preg_replace($pattern, "", $string);”正则方法实现字符串替换字符串即可。$1$2>

How to replace string with regular string in php

推荐:《PHP视频教程

php用正则表达式替换部分字符串

例如:

百度

将字符串中 style="max-width:90%"替换掉

百度';
$pattern = '//';
echo preg_replace($pattern, "", $string);

The above is the detailed content of How to replace string with regular string in php. For more information, please follow other related articles on the PHP Chinese website!

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