Concatenation Operators

Concatenation Operators

PHP concatenation operators are used to combine two or more strings into a single string. There are two main concatenation operators in PHP:

  1. The dot (.) operator: This operator is used to join two strings together. For example, if we have two strings $str1 and $str2, we can join them using the dot operator like this: $newStr = $str1 . $str2;

The .= operator: This operator is used to add a string to the end of an existing string. For example, if we have a string $str1 and we want to add another string to the end of it, we can use the .= operator like this: $str1 .= “additional text”;

Apply for PHP Certification!

https://www.vskills.in/certification/certified-php-developer

Back to Tutorials

Share this post
[social_warfare]
Viewing Options
Insertion Options

Get industry recognized certification – Contact us

keyboard_arrow_up