PHP Concatenation Operators

PHP Compensation Operator is used to combine character strings.

Operator Description
. The PHP concatenation operator (.) is used to combine two string values to create one string.
.= Concatenation assignment.

Example:

<?php
    $name="John";
    $lastName="Travolta";
    echo $name." ".$lastName; // Outputs John Travolta
    
    $a="Hello";
    $a .= " John!";
    echo $a; // Outputs Hello John!
?>


Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram

Notifications

Updates are enabled for this browser.

Receive new tutorials, articles and learning resources. You can turn updates off anytime.

Test browser code

Use this code in admin to send a test notification to this browser.