0
0
PHPprogramming~15 mins

String concatenation operator in PHP - Mini Project: Build & Apply

Choose your learning style9 modes available
String Concatenation Operator
📖 Scenario: You are creating a simple PHP script to combine parts of a greeting message. This is common when you want to build sentences from smaller pieces.
🎯 Goal: Build a PHP script that uses the string concatenation operator to join parts of a greeting message and display the full message.
📋 What You'll Learn
Create variables with exact string values
Use the string concatenation operator . to join strings
Print the final concatenated string
💡 Why This Matters
🌍 Real World
Combining strings is useful for building messages, file paths, or any text output dynamically.
💼 Career
Understanding string concatenation is essential for web developers working with PHP to create dynamic web pages.
Progress0 / 4 steps
1
Create greeting parts
Create two string variables called $greeting with the value "Hello" and $name with the value "World".
PHP
Need a hint?

Use = to assign strings to variables. Strings must be in double quotes.

2
Create a space variable
Create a string variable called $space and set it to a single space character " ".
PHP
Need a hint?

Remember a space is just a string with one space character inside quotes.

3
Concatenate strings
Create a variable called $message that concatenates $greeting, $space, and $name using the string concatenation operator ..
PHP
Need a hint?

Use the dot . operator between each variable to join them.

4
Print the message
Use echo to print the variable $message.
PHP
Need a hint?

Use echo $message; to display the combined string.