PHP used ', ' and '. ' The difference
$str 1 = ' Hello ';
$str 2 = ';
$str 3 = ' world ';
$str = $str 1. $str 2. $str 3;
Echo $str, '
‘; Hello world;
Novice questions, even six months of work also doubt.
How can I use ', '
echo $str 1, $str 2, $str 3, '
‘; Hello World
echo $str 1. $str 2. $str 3. ‘
‘; Hello World
/*
This line, is $STR1, $str 2, $str 3 in memory, stitching,
To compute a big string of ' Hello World ',
And then echo, get the result of the judgment.
echo $str 1. $str 2. $str 3. ‘
‘; Hello World
echo $str 1, $str 2, $str 3, '
‘; Hello World
Echo is a statement that is responsible for the output,
You can output multiple variables or values at once by ', ' split.
Comprehensive:
With '. ' Is stitching first, then the entire output.
Using ', ' is asked to output 3 variables.
Interview, you will encounter this question:
The above two situations, with ', ' and with '. ' Which output is fast, high efficiency?
A: The comma is fast because it eliminates the process of a concatenation calculation.