mixed str_ireplace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )
该函数返回一个字符串或者数组。该字符串或数组是将 subject 中全部的 search 用 replace 替换(忽略大小写)之后的结果。参数 count 表示执行替换的次数。<?php $str = 'hello,world,hello,world'; $replace = 'hi'; $search = 'hello'; echo str_ireplace($search, $replace, $str); ?>执行以上代码的输出结果为:
hi,world,hi,world
mixed substr_replace ( mixed $string , mixed $replacement , mixed $start [, mixed $length ] )
substr_replace() 在字符串 string 的副本中将由 start 和可选的 length 参数限定的子字符串使用 replacement 进行替换。<?php $str = 'hello,world,hello,world'; $replace = 'hi'; echo substr_replace($str, $replace, 0,5); ?>以上代码的执行结果为:
hi,world,hello,world
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有