• PHP Video Tutorials

PHP - Function Str Ireplace



Syntax

str_ireplace(find,replace,string,count)

Definition and Usage

It is used to replace the characters with some other characters

Return Values

It returns the string or an array of replaced values

Parameters

Sr.No Parameters & Description
1

find

It specifies the value to find

2

replace

It specifies the value to replace the value to find

3

string

It specifies the string to be searched

Example

Try out the following example

<?php
   $input = array("tutorials","point","simply","easy","learning");
   print_r(str_ireplace("simply","tutorials",$input,$i)); // Case-insensitive
   
   echo "<br>" . "Replacements: $i";  
?>

This will produce following result −

Array ( [0] => tutorials [1] => point [2] => tutorials [3] => easy [4] => learning ) 
Replacements: 1
php_function_reference.htm
Advertisements