PHP string str_ireplace() Function

PHP string str_ireplace() is predefined function. It is used to replace some character with some other characters. It is case-insensitive version of str_replace().

Note: This function is binary-safe.

Syntax:

ParameterDescriptionRequired/Optional
findSpecify the value to find.Required
replaceSpecify the value to replace.Required
stringSpecify the string to be searchedRequired
CountIt is variable that counts the number of replacement.Optional

Example 1

with using 'str_ireplace()' functionL:('PHP','JAVA','PYTHON','RUBY') By using 'str_ireplace()' function: PYTHON!

Output:

Your array string is: array('PHP','JAVA','PYTHON','RUBY')
Array ( [0] => JAVA [1] => JAVA [2] => PYTHON [3] => RUBY ) Replacements: 1

Example 3

Output:

Before using 'str_ireplace()': array('PHP','JAVA')
After using 'str_ireplace()':array('PHP','java','!')
Array ( [0] => B [1] => [2] => ! )

Next TopicPHP String




Latest Courses