My string looks like:
$fullPath = $dirName . \"/\" . $file;
If I replace / with \\, it gives error:
Expecting identifier
You might use apostrophes to denote a non-parsed string:
$fullPath = $dirName . '\' . $file;