replace special characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everybody!

I was wondering if you could help me with a little problem I ran into some days ago.

In my database I have some information about file paths. Originally, those paths come from a Windows Excel spreadsheet and look like "..\1 PDF Filer\65051.PDF". In my PHP code I try to do two things:

1) replace ".." with a string like "file://server/folder"
2) replace all "\" characters with "/".

The PHP code looks something like:

$path_to_file = "..\1 PDF Filer\65051.PDF";
$things_to_look_for = array("..", "\");
$things_to_replace_with = array("file://server/folder", "/");
$link = str_replace($things_to_look_for, $things_to_replace_with, $path_to_file);


The big problem is the character "\" which, if I got it right, in UNICODE is used for things like expressing line breaks ('\n' or something like this). The code above is resulting in the following error massage: "Parse error: parse error, expecting `')'' in /xxx/xxx/xxx/TMPz06yoces6o.php on line 2."

Is there a simple solution for this problem?

Regards,

Frank

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux