Locked lesson.
About this lesson
Understanding concatenation and concatenating assignment operators.
Exercise files
Download this lesson’s related exercise files.
String Operators.docx58.8 KB String Operators - Solution.docx
59 KB
Quick reference
String Operators
String operators allow you to concatenate strings together.
When to use
Any time you want to chain together strings, use the (.) string operator.
Instructions
When we talk about string operators, we're usually talking about concatenation using the (.) period.
<?php
$first = "John";
$last = "Elder";
echo $first . $last;
?>
You can also concatenate and assign using:
.=
Hints & tips
- concatenate with a period
- concatenate and assign with .=
Lesson notes are only available for subscribers.