How to append a string in PHP
Topic: PHP / MySQLPrev|Next
Answer: Use the PHP String Operators
There is no specific function to append a string in PHP. But you can use the PHP concatenation assignment operator (.=
) to append a string with another string.
Let's check out the following example to understand how it basically works:
Example
Run this code »<?php
$a = "Hello";
$a .= " World!";
echo $a; // Outputs: Hello World!
?>
See the tutorial on PHP operators to learn about the operators in detail.
Related FAQ
Here are some more FAQ related to this topic: