A string is text: letters, digits, spaces and symbols, wrapped in quotes.
<?php
$greeting = "Hello, world";
$name = 'Anil';
echo $greeting . ", " . $name;
Hello, world, Anil
Single or double quotes
Both create a string. Double quotes can put variables and special characters like \n inside. Single quotes keep the text exactly as written. Single and Double Quotes explains this in detail.
<?php
$name = "Anil";
echo "Hi $name\n";
echo 'Hi $name\n';
Hi Anil
Hi $name\n
Joining strings
The dot . joins two strings.
<?php
$first = "Anil";
$last = "Kumar";
echo $first . " " . $last;
Anil Kumar
Strings are not numbers
A number inside quotes is still a string.
<?php
var_dump(10);
var_dump("10");
int(10)
string(2) "10"
PHP will often convert between them for you, but it is better to know which one you have. Type Juggling shows when that conversion happens.
Strings are made of bytes
PHP counts bytes, not characters. For plain English text they are the same. For characters like é or Hindi letters, they are not.
<?php
echo strlen("cafe") . "\n";
echo strlen("café");
4
5
The accented é uses two bytes. Use the mb_ functions for such text. That is covered in Multibyte Strings.