PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

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.



Comment on this Question and Answer >>>

ASK A QUESTION

More strings PHP Questions

how to compare strings in PHP?

How do I make sure a string is a certain length?

How do I extract the values of variables from a string?

How do I find the position of a letter in a string in PHP?

print(1 . " + " . 2 . " = " . 1+2 . "n"); gives answer 3 why?



Custom Search