PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i got a strange problem. when i preview my code the left, center, right div had "\" in them eg <div align=\"center\">. i need to rid the "\" in them. the following code had "\" in them. i would like to get rid of the "\" in them. i would like to search for \" and replace with ".
the $content is displayed from a preview of post. in the $content i have the full code as below. i would like to replace all word of \" with " in it. i need an experience programmer to help me with them. thank you.
I don't understand your question. If this is a script, why don't you simply remove the backslashes in the editor? If you are processing this from some other source, describe where it is coming from.
it is coming from a forum post. the preview button. the preview places \" in the code. i need to remove them by some php code. if a person typed in "hello world\" and right aligned it, then the right align would not work because of the \ in them. in this case, i need to rid \ but not in hello world\. this is why i need to search for \" and not just search for \
But how are you getting this? Are you receiving this in a POST variable from a form? Are you scraping this from another forum? There are a lot of issues here, and you're not explaining where this data comes from well enough for me to offer any solution to you. Are you familiar with regular expressions, specifically the PHP function preg_replace() (http://php.net/manual/en/function.preg-replace.php)?
i getting this from a POST variable from a form. the div is not user generated. it from a forum button right align. the content if a forum preview from the preview button. why does it matter where the code came from. the code is "<div \"" from the $content. now how to rid the \" from $content? the preg_replace() is what i need but i am not sure how to use it. can i have an example in my case?
the above quote will remove all \ and even the ones the user posts. i needed to search for \" and replace with " will this work? notice the quotes in code below