My string looks like:
$fullPath = $dirName . "/" . $file;
If I replace / with \, it gives error:
Expecting identifier or variable
I want to store in the latter way itself. How to override anything coming in between?
\
is an escape character. It is a special character used to define either escape sequences or to escape string-delimiters if you want to use them in the string itself.
The correct usage is to escape the escape character like this: \\
. This will tell the parser the you wanted the literal backslash and not the special meaning of it.