<?php
//mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )
//在$subject中用$replace替换$search ,最后返回替换后的字符串和[替换的次数];
$str='This is a test , This is a real test , hello world';
$str=str_replace('test', 'show time', $str, $count);
echo $str; //输出替换后的字符串 This is a show time , This is a real show time , hello world
echo '<hr/>';
echo $count; //输出被替换的次数 2
?>
str_replace函数应用
最新推荐文章于 2024-07-21 22:49:36 发布