<?php

$str = '\\\\a';
echo $str . PHP_EOL;
$r   = preg_replace('~\\\\~s', '*', $str);
echo $r;