Easy Tutorial
❮ Func Error Get Last Func String Quoted Printable Decode ❯

PHP str_ireplace() Function

PHP String Reference Manual

Example

Replace the character "WORLD" (case-insensitive) in the string "Hello world!" with "Peter":


Definition and Usage

The str_ireplace() function replaces some characters in a string (case-insensitive).

This function must follow these rules:

Note: This function is case-insensitive. Use the str_replace() function for case-sensitive search.

Note: This function is binary-safe.


Syntax

Parameter Description
find Required. Specifies the value to find.
replace Required. Specifies the value to replace the value in find.
string Required. Specifies the string to be searched.
count Optional. A variable that counts the number of replacements.

Technical Details

Return Value: Returns a string or array with replaced values.
PHP Version: 5+
--- ---
Changelog: The count parameter was added in PHP 5.0.
--- ---

More Examples

Example 1

Using the str_ireplace() function with an array and a count variable:

Example 2

Using the str_ireplace() function with fewer elements to replace than found:


❮ Func Error Get Last Func String Quoted Printable Decode ❯