I’m trying to remove repeated slashes and while I’m tying it, I get errors. It seems some characters have to be escaped but I can’t tell which one.
<?php
$path = preg_replace('(\\){2,}', '$1', 'z:\\\aaa\\\\bbb\c\ddd\');
echo $path;
?>
This gives,
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE
Could somebody fix this?
This part:
should be:
You’re escaping the closing quotation mark with a backslash, so the string doesn’t end.