1<?php
2//str_replace("Original Value", "Value to be replaced", "String");
3$result = str_replace("1", "2", "This is number 1");
4// Output: This is number 2
5?>
1$var1 = 'hello.world';
2$var2 = str_replace(".", "-", $var1);
3echo $var2; // hello-world
4
1//replaces every occurence of $search with $replace in the string $subject
2str_replace ($search, $replace, $subject);
1str_replace ( array|string $needle , array|string $needle_replacement , string|array $haystack , int &$output_count = null ) : string|array
2str_replace ($needle, $needle_replacement, $haystack, $output_count);
3 // $needle --> the string value or array of string values you're looking for
4 // $needle_replacement --> the string value or array of string values you'll replace the needle(s) with
5 // $haysytack --> the string or array of strings you'd like to search/replace needles in
6 // $output_count --> not an input, but can be used to get an aggregator to count how many needles were replaced
7
8str_replace ($needle, $needle_replacement, $haystack) //w/out count