What happens when multiple instances of the search string overlap? : String Replace « String « PHP






What happens when multiple instances of the search string overlap?


<?
$tricky_string = "ABA is part of ABABA";
$maybe_tricked = str_replace("ABA", "DEF", $tricky_string);
print("Substitution result is '$maybe_tricked'<BR>");

?>

           
       








Related examples in the same category

1.Quantifier Syntaxes
2.str_replace: @ (at)
3.Replacing a Pattern with a Found String
4.Replace the tag content without getting rid of any attributes
5.String replace with Regular Expressions
6.String replace: index and value