Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Escaping backslashes??

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Escaping backslashes??

Postby NigWel » Tue Jun 24, 2003 6:05 am

I am trying to get PHP to do the following for me:

replace \\ with \
replace \ with <br>

I've tried the following:

$target = str_replace("\\\\","\\", $target);
Followed by:
$target = str_replace("\\", "<br>", $target);

The result is where you get "\" it is replaced with "<br>" HOWEVER where you get "\\" it is just replaced with "<br><br>".

I've also tried $target = eregi_replace("\\\\", "\\" $target); but this does not work at all!

Can anyone help? Ta, Nigel[/b]
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Jun 24, 2003 5:58 am
Location: Leicester (UK)

Postby Redcircle » Wed Jun 25, 2003 12:04 am

have you tried stripslashes()?
User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.