PHP MYSQL - Operators - 5.6 String Operators

 

PHP String Operators

PHP has two operators that are specially designed for strings.

OperatorNameExampleResult
.Concatenation$txt1 . $txt2Concatenation of $txt1 and $txt2
.=Concatenation assignment$txt1 .= $txt2Appends $txt2 to $txt1

<!DOCTYPE html>
<html>
<body>

<?php
$txt1 = "Vesrn";
$txt2 = "Technologies";
echo $txt1 . $txt2;
?>  

</body>
</html>

Output:
VesrnTechnologies

2)<!DOCTYPE html>
<html>
<body>

<?php
$txt1 = "Vesrn;
$txt2 = "Technologies!";
$txt1 .= $txt2;
echo $txt1;
?>  

</body>
</html>

Output:
VesrnTechnologies

Popular posts from this blog

COPA Bits for Computer Based Test (CBT) by Venugopal Vanjarapu

COPA

Operating System