+ 2
What is concatenation in php?Please answer the question if you know the answer.
4 Respostas
+ 4
Concatenation is the process of appending one string with another, which can be achieved with the dot operator in PHP, like this:
$text = "Hello ";
$text2 = "world!";
$text .= $text2;
echo $text;
The output is hello world.
+ 15
i am not sure for php but in most programming languages concatenation means to concate two string like : "string1" + "string2" so result string is: "string1string2"
+ 3
Vukan, if you use the + operator with a string you will get unexpected behavior. PHP will convert the string to a number and try to add it. If not possible, it will return 0.
+ 1
It's the dot (.) that makes the concatenation in PHP. It's part of the so called string operators. Examp#See below:
$firstName = 'John';
$lastName = 'Doe';
$fullName = $firstName . ' ' . $lastName;
echo $fullName;
It outputs "John Doe", with space in between them.