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:
for ($i=0; $i<strlen($file_dir); $i++)
{
if ($file_dir{$i} == "\\")
{
$file_dir{$i} = "/";
}
}
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