RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting

change backslash to foward slash

Join Date: Oct 2004
Location: San Francisco, CA
Posts: 338
Reputation: paradox814 is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

change backslash to foward slash

  #1  
Sep 5th, 2005
how do I reverse the direction of a slash? I am trying to reverse the slashes in the directory path of a windows system.

I have tried so many things but then when I actually test it to make sure it works, it always fails, so I decided to try it via brute force. Again this fails because of special symbols, take for example:

[PHP]for ($i=0; $i<strlen($file_dir); $i++)
{
if ($file_dir{$i} == "\\")
{
$file_dir{$i} = "/";
}
}[/PHP]

when I finally tried this method it works wonderfully until I hit some special cases like when I have a folder called:
C:\temp\2004
it turns it into (a tab and some weird symbol in there):
C: emp€4
but I really want it to look like:
C:/temp/2004
AddThis Social Bookmark Button
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:24 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC