What does the following command do in PHP?
. $string // ($string is something which I declared in the program)
the " . = " operator is a string operator, it first converts the values to strings; and since " . " means concatenate / append, the result is the string " 120 ".
This is the so called "splat" operator. Basically that thing translates to "any number of arguments"; introduced with PHP 5.6.
There are two string operators. The first is the concatenation operator ('. '), which returns the concatenation of its right and left arguments. The second is the concatenating assignment operator (' .
The PHP concatenation operator (.) is used to combine two string values to create one string. Concatenation assignment. Example: <?
On its own, that does nothing at all (it's not valid syntax). However, if you have something like this:
<?php $string1 = "Hello "; $string2 = "world!"; $string = $string1 . $string2; echo $string; ?>
You will see Hello world!
. The .
is the string concatenation operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With