首页 >函数列表 >str_ireplace

str_ireplace

str_ireplace

(PHP 5)

str_ireplacestr_replace() 的忽略大小写版本

说明

mixed str_ireplace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )

该函数返回一个字符串或者数组。该字符串或数组是将 subject 中全部的 search 都被 replace 替换(忽略大小写)之后的结果。如果没有一些特殊的替换规则,你应该使用该函数替换带有 i 修正符的 preg_replace() 函数。

参数

search

Note:

search 元素的每次替换都是基于前一次替换结果的。

replace

subject

如果 subject 是一个数组,替换操作将遍历整个 subject,并且也将返回一个数组。

count

needles 的匹配和替换数量将在 count 中返回,它是以引用方式传递的。

如果 searchreplace 为数组,那么 str_replace() 将对 subject 做二者的映射替换。如果 replace 的值的个数少于 search 的个数,多余的替换将使用空字符串来进行。如果 search 是一个数组而 replace 是一个字符串,那么 search 中每个元素的替换将始终使用这个字符串。

返回值

返回替换后的字符串或者数组。

更新日志

版本 说明
5.0.0 新增 count 参数。

范例

Example #1 str_ireplace() 范例

<?php
$bodytag 
str_ireplace("%body%""black""<body text=%body%>");
?>

注释

Note: 此函数可安全用于二进制对象。

参见


  • addcslashes
  • addslashes
  • bin2hex
  • chop
  • chr
  • chunk_split
  • convert_cyr_string
  • convert_uudecode
  • convert_uuencode
  • count_chars
  • crc32
  • crypt
  • echo
  • explode
  • fprintf
  • get_html_translation_table
  • hebrev
  • hebrevc
  • hex2bin
  • htmlentities
  • htmlspecialchars
  • htmlspecialchars_decode
  • html_entity_decode
  • implode
  • join
  • levenshtein
  • localeconv
  • ltrim
  • md5
  • md5_file
  • metaphone
  • money_format
  • nl2br
  • nl_langinfo
  • number_format
  • ord
  • parse_str
  • print
  • printf
  • quoted_printable_decode
  • quoted_printable_encode
  • quotemeta
  • rtrim
  • setlocale
  • sha1
  • sha1_file
  • similar_text
  • soundex
  • sprintf
  • sscanf
  • strcasecmp
  • strchr
  • strcmp
  • strcoll
  • strcspn
  • stripcslashes
  • stripos
  • stripslashes
  • strip_tags
  • stristr
  • strlen
  • strnatcasecmp
  • strnatcmp
  • strncasecmp
  • strncmp
  • strpbrk
  • strpos
  • strrchr
  • strrev
  • strripos
  • strrpos
  • strspn
  • strstr
  • strtok
  • strtolower
  • strtoupper
  • strtr
  • str_getcsv
  • str_ireplace
  • str_pad
  • str_repeat
  • str_replace
  • str_rot13
  • str_shuffle
  • str_split
  • str_word_count
  • substr
  • substr_compare
  • substr_count
  • substr_replace
  • trim
  • ucfirst
  • ucwords
  • vfprintf
  • vprintf
  • vsprintf
  • wordwrap
  • PHP MySQL HTML CSS JavaScript MSSQL AJAX .NET JSP Linux Mac ASP 服务器 SQL jQuery C# C++ java Android IOS oracle MongoDB SQLite wamp 交通频道