What are common mistakes made by PHP beginners when handling strings and escaping characters?

Common mistakes made by PHP beginners when handling strings and escaping characters include not properly escaping special characters, using single quotes instead of double quotes for string interpolation, and forgetting to use functions like htmlspecialchars() to prevent XSS attacks.

// Incorrect way of handling strings without escaping characters
$name = $_GET['name'];
echo 'Hello, $name!'; // Using single quotes will not interpolate variables

// Correct way of handling strings with escaping characters
$name = htmlspecialchars($_GET['name']);
echo "Hello, $name!"; // Using double quotes will interpolate variables and escape characters