perl - Why a full stop, "." and not a plus symbol, "+", for string concatenation in PHP? -
Why did the PHP designer decide to use a full stop / duration? " As compared to the more common plus symbol "+" as the string concatenation operator?
Is it any advantage, or for some reason? Or do they just like? : O)
The most obvious reason is that PHP has many syntax Perl - and uses a dot (.
) for parl string synthesis
But, we can put a deep crater in it and understand why it was implemented in Perl - most of the +
operator for mathematical equations Is used - it is used only for inclusion in those languages, in which the variable type can define the method in which the operator works (simple explanation, for example C #)
< Code> var intAddition = 1 + 2; Console.WriteLine (intAddition); // print 3 var string concrete = "1" + "2"; Console.WriteLine (stringConcat); // print "12"
^ As you can see, the +
operator is used for both concatenation and C.
The argument goes to the low level and is caused by the Boolean algebra in the door of logic - +
means or
while .
is used as and
as an operator - which makes sense when it comes to string containment.
It is understood by two different operators, for one combination and for an additional - it is only unfortunate that these two languages can be mixed due to other languages.
Comments
Post a Comment