Escaping backslashes??

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

NigWel
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Jun 24, 2003 5:58 am
Location: Leicester (UK)

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]

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

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

have you tried stripslashes()?


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron