The string operators exist used to help the string manipulation. There are two string operators in PHP; the first one is used to concatenate two strings and is represented by a dot (.), while the second one appends the next string into the existing variable and is represented as (‘. =’).

Example of string operators in PHP

<?php
    $a = "This is ";  
    $b = $a . "PHP tutorial"; // The output is 'This is PHP tutorial'
    $a .= "PHP tutorial"; // The output is also 'This is PHP tutorial'
?>

 

›› go to examples ››