I want to concatenate a backslash between two variables when passing them in the arguments of a function so they form a filepath.
turbo_function($variable1.\.$variable2, $otherargument);
I'm sure the backslash needs to be escaped. I've tried wrapping it in quotes and double quotes.
How can I concatenate the backslash to the variables successfully?
You concatenate strings by using the + operator. For string literals and string constants, concatenation occurs at compile time; no run-time concatenation occurs. For string variables, concatenation occurs only at run time.
In JavaScript, we can assign strings to a variable and use concatenation to combine the variable to another string. To concatenate a string, you add a plus sign+ between the strings or string variables you want to connect.
The concatenation operator is a binary operator, whose syntax is shown in the general diagram for an SQL Expression. You can use the concatenation operator ( || ) to concatenate two expressions that evaluate to character data types or to numeric data types.
Syntax: string new_string = string init + string add; This is the most easiest method for concatenation of two string. The + operator simply adds the two string and returns a concatenated string.
Escape the backslash with a backslash !
Like this..
turbo_function($variable1."\\".$variable2, $otherargument);
Such:
$variable1 . "\\" . $variable2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With