Reply to Re: replace single slash with double slash

Your name:

Reply:


Posted by dkirkdrei on 09/22/07 01:39

On Sep 21, 9:32 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> dkirkd...@yahoo.com wrote:
> > I am having a bit of trouble trying to double up on slashes in a file
> > path. What I am trying to do is very similar to the code below:
>
> > <?
> > $var = "\\wusais\Intranets\Intranets\fpdb\pdf\weinig\00505882.pdf";
> > $new = preg_replace("\\", "\\\", "$var");
> > ?>
>
> > Code above produces the following error:
>
> > Parse error: parse error, unexpected T_VARIABLE in c:\Inetpub\wwwroot
> > \pages\replace.php on line 12
>
> > In the end, $new needs to be: \\\\wusais\\Intranets\\Intranets\\fpdb\
> > \pdf\\weinig\\00505882.pdf
>
> > but it seems to be very difficult replacing slashes.
>
> > Any help would be greatly appreciated
>
> Why go to all that trouble? str_replace is much easier and faster.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================- Hide quoted text -
>
> - Show quoted text -

tried:

<?
$var = "\\wusais\Intranets\Intranets\fpdb\pdf\weinig\00505882.pdf";
$new = str_replace("\\", "\\\\", "$var");
?>

and received:

\\wusais\\Intranets\\Intranets\\fpdb\\pdf\\weinig05882.pdf

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация