How to combine backslash between two variables?

I want to combine a backslash between two variables when passing them in function arguments so that they form a file path.

turbo_function($variable1.\.$variable2, $otherargument);

I'm sure the backslash should be escaped. I tried wrapping it in quotation marks and double quotes.

How to compile backslash with variables successfully?

+4
source share
3 answers

Remove backslash with backslash!

Like this..

turbo_function($variable1."\\".$variable2, $otherargument);
+5
source
  • It must be a string
  • This is an escape character, so it must be escaped inside the string.

Such:

$variable1 . "\\" . $variable2
+2
source

, . :

$concatinatedVar = $variable1."\\".$variable2;
turbo_function($concatinatedVar , $otherargument);
0

All Articles