|
|
str_replace Function in PHP
|
Tutorials » Php »
|
Topic |
What is str_replace Function?
|
|
Explanation |
|
In PHP, this function is used to replace all occurrences of the search string with the replacement string, this function is case sensitive.
Syntax:
str_replace(search,replace,string,count)
In the above syntax "search" specifies the value to be replaced,"replace" specifies the value to be replaced with, "string"
specifies the string to be searched in, "count" specifies the variable with the number of replacements.
Example:
<?php
echo str_replace("India","Folks","Hiox India");
?>
Result:
Hiox Folks
In the above example "Hiox India", "India" is replaced with "Folks",since the function is case
sensitive the strings are in matching case.
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|