Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Combining data in a string is called concatenation. Besides using double quotes to add another variable into a string, PHP string concatenation also provides two string operators.
Concatenation
There are two string operators. The first is the concatenation operator ('.'), which returns the concatenation of its right and left arguments. The second is the concatenating assignment operator ('.='), which appends the argument on the right side to the argument on the left side. Please read Assignment Operators for more information.
To summarize concatenation. If you want to add a single variable to a string you can include that variable within your double quoted assignment. If you are concatenating a single line you would use a single dot between each string. If you are concatenating multiple lines, you should use the .= assignment operator.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up