PHP中的str_ireplace()函数
str_ireplace()函数用于将字符替换为其他一些字符。
注意-该函数不区分大小写
语法
str_ireplace(find,replace,str,count)
参数
find-要搜索的值
replace-将值替换为find中的值
str-要搜索的字符串
count-更换数量
返回
str_ireplace()函数返回具有替换值的字符串或数组。
以下是一个例子-
示例
<?php
$str = "I am Amit";
$res = str_ireplace("Amit", "David", $str);
echo $res;
?>以下是输出-
输出结果
I am David
让我们看另一个例子-
示例
<?php
$myArr = array("one","two","three");
print_r(str_ireplace("three","four",$myArr,$c));
echo "<br>" . "Number of Replacements = $c";
?>以下是输出-
输出结果
Array ( [0] => one [1] => two [2] => four ) Number of Replacements = 1
热门推荐
5 十月简短祝福语
9 医政科祝福语简短
10 形容新年的祝福语简短
11 团队文案祝福语简短励志
12 朋友孩子考试祝福语简短
13 牛年女神节祝福语简短
14 顾客简短祝福语大全集
15 妈妈给宝贝祝福语简短
16 恭喜朋友买车祝福语简短
17 参加儿子大学祝福语简短
18 商业mc祝福语大全简短