String variable is a variable that can store a series of characters.
$string1 = “Hello”;
$string2 = “World”;
echo $string1. “”. $string2;
To concatenate string we use the operator.
Keep in mind that the echo command above can be made longer as follows:
threw out ” “;
As one exercises, we can summarize the output of multiple variables in a single command.
When a string enclosed in double quotes contains a variable inside it, it is treated as such, therefore its content will be used for storage.
$day = 10;
$date = “Today is $day”;
The display shows: Today is 10
That is, in the chain, the name of the variable $day is replaced, with the content of the same.
A string can be defined with single quotes (but it is important to note that variables are not substituted if we use single quotes):
$name = ‘juan carlos’;