Home » PHP str_ireplace() function

PHP str_ireplace() function

by Online Tutorials Library

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:

Parameter Description Required/Optional
find Specify the value to find. Required
replace Specify the value to replace. Required
string Specify the string to be searched Required
Count It 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

You may also like