", $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
php正则字符串替换字符串的方法:首先创建一个PHP示例文件;然后通过“preg_replace($pattern, "", $string);”正则方法实现字符串替换字符串即可。$1$2>
推荐:《PHP视频教程》
php用正则表达式替换部分字符串
例如:
<a style="color:#ccc; font-size=14px;" href="http://baidu.com">百度</a>
将字符串中style="color:#ccc; font-size=14px;"替换掉
/'; 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!