On a related topic, .= has a derivitive. . (dot) can be used in complex variable assignments.
For example if you wanted to use an inline function use the following: $html = "PI = ".number_format(M_PI,"2",".","")." = ".M_PI."!";
Where the RED code is outside of the quotes so that the function will execute correctly. Otherwise the output would read: PI = number_format(M_PI,"2",".","") = M_PI! Instead of: PI = 3.14 = 3.14159265359!
This allows strings to be mixed with functions etc... Saves from repetitive coding and as a result time. Makes the code cleaner and easier to read when an entire string "sentence" is all together on the same line.
echo $string3 . ' ' . $string4;
//results: Hello, World! Hello, and welcome to my World!
The period/dot is our means of joining or linking our variables/strings/etc.
$var .= 'hey'; // means $var = $var . 'hey';
When you talk about concatenating NULL (nothingness) initialised variables, you should really make sure that is the case. All variables should be initialised as NULL but there's no gaurantee that this would be the case and if you concatenate a variable that you expected should have been NULL but wasn't, you might get undesirable or incorrect results.
It's safer to initialise the variable first then concatenate onto it.
I was coding one of my php page today, when I realized that I had to add multiple values to a variable (now that I think of it, a solution with arrays is possible too). But, the problem is that I have to add them in different parts of the code, so the new line that defines the variable will cover up the previous one. I played around with the code, and I finally got this solution:
$message = "test1";
$message .= "test2";
$message .= "test3";
By adding a dot in front of the = sign, I could concatenate the previous value with the new one and put them in the same variable. So... Yeah... This is just something I figured out, and I'm sure most people know about this. I just had to share... ;P
Oh, btw, a dot on the first = works too. It still "concatenates" the nothingness before it and the new value.