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!
Moderator: General Moderators
deathy
Forum Newbie
Posts: 7 Joined: Tue Jun 03, 2003 2:51 pm
Post
by deathy » Thu Oct 21, 2004 5:59 pm
how can i change a / to a \ in my php script ?
JynxI
qads
DevNet Resident
Posts: 1199 Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane
Post
by qads » Thu Oct 21, 2004 6:02 pm
[php_man]str_replace[/php_man]
kettle_drum
DevNet Resident
Posts: 1150 Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England
Post
by kettle_drum » Thu Oct 21, 2004 6:05 pm
Code: Select all
$string = "////////";
$string = str_replace("/", "\", $string);
echo $string;
The forum doesnt show two \ in the str_replace. You need to use \\.