RE: [PHP] preg_replace - understanding
| From: | Ford, Mike [LSS] | Date: | Wed, 09 Jul 2003 10:06:28 +0000 |
| Subject: | RE: [PHP] preg_replace - understanding | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-154512@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Jennifer Goodie [mailto:goodie@apollointeractive.com]
> Sent: 09 July 2003 00:43
>
> > $filevalue = str_replace("\\", "/", $filevalue);
> >
> > it is reversing the "\\" to "//" but not replacing them
> with just a single
> > "/".
>
> I think you need to escape your \ so each \ is \\ so your
> string should be
> "\\\\"
Or use single quotes for your strings:
$filevalue = str_replace('\\', '/', $filevalue);
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211