PHP String Operator

By | March 29, 2014
0
0



String Operator

When you start writing PHP code, you will realize the importance of string operators. PHP uses twokinds of string operators, concatenation (.) the dot sign and concatenating assignment (.=) the dot and equal to sign.The concatenation operator is used when you want to combine the left and right argument between which the operator is placed. The concatenating assignment operator is a combination of the concatenation operators and the assignment operator.

Concatenation Operator
<?php
   $a = "My name is ";
   $b .= "Rishi";
   echo $b;

The output of the code is: My name is Rishi.

Concatenating Assignment operator
<?php
  $a = "My name is";r/>  $a.= "Rishi";
  echo $a;
?>

The output of the code is: My name is Rishi.

Leave a Reply

Your email address will not be published. Required fields are marked *