During a conference that I attended some time ago, a .NET programmer that was a speaker there asked a question:
"Why is the concatenation operator in PHP different from the other languages?"
More exactly, why is it a dot instead of a plus?
At that time, nobody present knew the answer. Today, while playing with JavaScript I think that I found one reason. I'm curios if this is indeed the main reason why it's a dot instead of a plus.
I'll use JavaScript for the example:
var foo = 7;
var bar = 3;
console.log(foo+bar);
In this case, both variable's type is integer so the plus will behave the same way as it does in math, calculating the sum. The result will be 10.
Next scenario:
var foo = 7;
var bar = "3";
console.log(foo+bar);
In this case "foo" is an integer and "bar" is a string. The result would be 73.
I guess that a dot was used instead of a plus to kill some ambiguity regarding this particular case.
Just before posting this question I noticed a similar question on SO that have a similar answer to what I discovered today.
This is the link to the question: Why is the php string concatenation operator a dot (.)?
Are there any more reasons besides this? Thank you for your time and please let me know if I need to edit my question before downrating. :)