php str_ireplace函数用于字符串交换操作,没有区别巨细写,其语法是str_ireplace(find,replace,string,count)。参数find必须,规则要查找的值;replace必须,规则交换 find 中的值的值;string必须,规则被搜寻的字符串。
php str_ireplace函数怎样用?
php str_ireplace()函数 语法
作用:字符串交换操作,没有区别巨细写。
语法:
str_ireplace(find,replace,string,count)
参数:
find 必须。规则要查找的值。
replace 必须。规则交换 find 中的值的值。
string 必须。规则被搜寻的字符串。
count 可选。一个变量,对交换数进行计数。
阐明:
交换字符串中的一些字符(没有区别巨细写)。该函数必需遵照下列规定:假如搜寻的字符串是一个数组,那末它将前往一个数组。假如搜寻的字符串是一个数组,那末它将对数组中的每一个元素进行查找以及交换。
假如同时需求对数组进行查找以及交换,而且需求执行交换的元素少于查找到的元素的数目,那末过剩元素将用空字符串进行交换。假如是对一个数组进行查找,但只对一个字符串进行交换,那末代替字符串将对一切查找到的值起作用。
php str_ireplace()函数应用示例1
<?php echo str_ireplace("WORLD","php.cn","Hello world!"); ?>
输入:
Hello php.cn!
php str_ireplace()函数应用示例2
<?php echo str_ireplace("hello","Hi","hello php.cn!"); ?>
输入:
Hi php.cn!
以上就是php str_ireplace函数怎样用的具体内容,更多请存眷资源魔其它相干文章!
标签: php开发教程 php开发资料 php开发自学 php str_ireplace
版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。
抱歉,评论功能暂时关闭!