|
str_replaceReplace all occurrences of the search string with the replacement string Description
mixed str_replace
( mixed
$search
, mixed $replace
, mixed $subject
[, int &$count
] )
This function returns a string or an array with all occurrences of
If you don't need fancy replacing rules (like regular expressions), you should always use this function instead of preg_replace. Parameters
If
If
Return ValuesThis function returns a string or an array with the replaced values. Examples
Example #1 Basic str_replace examples
<?php
Example #2 Examples of potential str_replace gotchas
<?php Notes
Caution
Replacement order gotchaBecause str_replace replaces left to right, it might replace a previously inserted value when doing multiple replacements. See also the examples in this document.
See Also
|