PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I join strings together?


This is called concatenation, as the Latin fans out there will know this comes from the Latin 'con' for 'with' and 'catena' for 'chains', so they are chained or linked together.

That's the language lesson over. Period. In fact it's all about the period (.) or if you speak English outside of America, the stop, or full stop character.

Here's an example:
<?php
$a 
"I feel";
$b " lonely";
$isolation $a $b;
echo 
"$isolation"// I feel lonely
?>


... and that's all there is to it, simply use the '.' between the strings that you want to join together. Note that you will need to be careful with your spacing when joining strings together if you don't want characters to appear next to each other; often therefore you'll need to include a space character in your concatenation.



More strings PHP Questions

How do I make the contents of a string upper case?
How do I display newline characters on a webpage?
How do I make the first letter of a string uppercase?
How do I extract the values of variables from a string?
What is the difference between join and implode in PHP?