Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
Chemistry
Biology and Medical
Earth Sciences
Computer Science
Computing and Technology
DIY Projects
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
Chemistry
Biology and Medical
Earth Sciences
Computer Science
Computing and Technology
DIY Projects
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Other Sciences
Programming and Computer Science
PHP str_replace function problem
Reply to thread
Message
[QUOTE="chrisalviola, post: 2632918, member: 71031"] I have this PHP code to edit all HTML text to be displayed so that it won't appear as HTML but as standard text. <?php function htmlformat($sinput){ $newphrase = str_replace("<", "<", $sinput); $newphrase = str_replace(">", ">", $newphrase); $newphrase = str_replace(chr(13),"<br>",$newphrase); $newphrase = str_replace(chr(34), """, $newphrase); $newphrase = str_replace(chr(32), " ",$newphrase);$newphrase=str_replace("[COLOR=red]","<font color=red>",$newphrase); $newphrase=str_replace("[/COLOR]","</font>",$newphrase); $newphrase=str_replace("[PLAIN]","<img src=",$newphrase); $newphrase=str_replace("[/PLAIN]",">",$newphrase);return $newphrase; } ?>the problem is this part of the code $newphrase = str_replace(chr(32), " ",$newphrase);it only replace the single spaces with but what about multiple spaces? when I have 2 more spaces on the text it can't seem to replace it with [/QUOTE]
Insert quotes…
Post reply
Forums
Other Sciences
Programming and Computer Science
PHP str_replace function problem
Back
Top