php str_ireplace() function


  Translation results:

UK[rɪˈpleɪs] US[rɪˈples]

vt.Replace; replace; put... back into its original place; (with...) replace

Third person singular: replaces Present participle: replacing Past tense: replaced Past participle: replaced

php str_ireplace() functionsyntax

Function: String replacement operation, case-insensitive

Syntax: str_ireplace(find,replace,string,count)

Parameters:

ParametersDescription
find Required. Specifies the value to look for.
replace Required. Specifies the value to replace the value in find .
string Required. Specifies the string to be searched for.
count Optional. A variable counting the number of substitutions.

Description: Replace some characters in the string (not case sensitive). The function must follow the following rules: If the searched string is an array, then it will return an array. If the string being searched is an array, then it will find and replace each element in the array. If both an array search and a replace are required, and the number of elements to be replaced is less than the number of elements found, the excess elements will be replaced with an empty string. If you search an array and replace only one string, the replacement string will apply to all found values.

php str_ireplace() functionexample

<?php
echo str_ireplace("WORLD","php.cn","Hello world!");
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

Hello php.cn!


<?php
echo str_ireplace("hello","Hi","hello php.cn!");
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

Hi php.cn!

Home

Videos

Q&A