-
mutiple str_replace?
I have tried to enter the str_replace string, but with the last part, in bold, str_replace("example","dd",$text);
it shows the value of $text, as it should i think.
now if i do,
str_replace("example","dd",$text);
str_replace("dynamic","dd",$text);
it will print the content of $text 2 times, because (i think) of the $text part....
how do you stop it from showing the content of $text more than once?
P.S - Sorry if i have confused you
-
-
$text = str_replace($find1,$replace1,$text);
$text = str_replace($find2,$replace2,$text);
echo $text;
You need to set something equal to the value of str_replace, not just run it.
str_replace() by itself is no more productive than running the line "$text;". That won't generate output or change the stringe.
Then simply use echo when you would like for the new version of $text, and that's it.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks