0PricingLogin
PHP Academy · Lesson

String Basics and Concatenation

Build and join strings in PHP with . and interpolation.

Strings in PHP

A string is a sequence of characters. PHP strings are binary-safe and can contain any byte. They are immutable — string operations return new strings, they don't modify originals.

Single vs Double Quotes

Single-quoted strings are literal; double-quoted strings parse variables and escape sequences:

<?php
$name = 'Alice';

echo 'Hello $name\n'; // Hello $name\n  — literal
echo "Hello $name\n"; // Hello Alice    — parsed

// Prefer single quotes for performance when no interpolation needed

All lessons in this course

  1. String Basics and Concatenation
  2. Searching and Replacing in Strings
  3. Substring and Padding Functions
  4. Splitting and Joining Strings
← Back to PHP Academy