What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Can't treat backslashes as text in PHP

Can't treat backslashes as text in PHP
Author: Message:
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
O.P. Can't treat backslashes as text in PHP
Simple really, but I am not the best syntax expert and I need the help nice and quick please.
code:
$media = str_replace('\', '', $media);
It is that simple. I can't treat backslashes as text in a string no matter what I try and do. I am trying to get rid of backslashes from a variable and this is the only simple way I can think of. So the syntax fix would help me a lot. Thanks a bunch of bananas :).
07-31-2006 04:47 PM
Profile PM Find Quote Report
alexp2_ad
Scripting Contest Winner
****

Avatar
Who love the chocolate?

Posts: 691
Reputation: 26
37 / Male / –
Joined: May 2004
Status: Away
RE: Can't treat backslashes as text in PHP
You have to use a double backslash, since backslash is an escape character used for stuff like new lines (\n), so just '\\' will do nicely.
07-31-2006 04:51 PM
Profile E-Mail PM Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
O.P. RE: Can't treat backslashes as text in PHP
I already tried that, and it still produces the same result :P. I am a bit confused on what to do here, nothing seems to work.

Edit: Found the solution, another variable was messing with the $media one. I moved it up the page and now it works :).

This post was edited on 07-31-2006 at 04:55 PM by absorbation.
07-31-2006 04:53 PM
Profile PM Find Quote Report
ayjay
Senior Member
****

Avatar

Posts: 850
Reputation: 58
– / Male / Flag
Joined: Mar 2004
RE: Can't treat backslashes as text in PHP
Just use stripslashes() :P
07-31-2006 10:58 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On