Hi Friends,
The DOT(.) operator is used to concatenate two variable or string in PHP. The ‘.’ operator which returns the concatenation of its right and left string.
eg:
And also ‘.=’ operator used append the arguments on the right side to the left side arguments.
eg:
Example 1
'; echo "hello". "World"; echo ''; // Output: helloworld $a1 = "Hello "; $a1 .= "World!"; // now $a1 contains "Hello World!" echo $a1; echo "hi". "welcome"; ?>
Example 2
'; echo'this is ', $a ,' and ', $b; //output: this is hello and world echo "
"; echo"this is $a and $b"; // Output:this is hello and world ?>
COMMA is not concatenating it just used to echo one by one and in that way complete string appears together.In javascript PLUS(+) is used as concatenation operator.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.