preg_match_all 和 preg_replace 区别

str_replace 区分大小写 str_ireplace 不区分大小写
preg_match_all 和 preg_replace 的区别简单说 是两个用法相反的字符串替换函数;

   preg_replace ( )      --------   去掉字符串中不需要的部分,取其他部分;

   preg_match_all ( )   --------  取字符串中需要的部分,其他部分去掉;

preg_replace是用来替换 类似性的有规律性的内容的,str_replace是用来 替换 已知的 内容的,可以是有规律的也可以是没有规律的,替换的值 由你手动写的
注:str_replace在php4里 无法使用
在字符串替换的函数里,str_replace()的使用率是最高的

猜你喜欢

转载自blog.csdn.net/Sncdma/article/details/127192522