WEB TUTORIALS
PRACTICE EXAMPLES
HTML REFERENCES
CSS REFERENCES
PHP REFERENCES

How to combine two strings in PHP

Topic: PHP / MySQLPrev|Next

Answer: Use the PHP Concatenation Operator

You can use the PHP concatenation operator (.) to combine or join two strings together in PHP. This operator is specifically designed for strings. Let's see how it works:

<?php
$str1 = 'Hello';
$str2 = 'World!';
$new_str = $str1 . ' ' . $str2;
echo $new_str; // Outputs: Hello World!
?>

Related FAQ

Here are some more FAQ related to this topic:

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties