What are some potential pitfalls when using double quotes or single quotes in PHP?

Using double quotes or single quotes in PHP can lead to potential pitfalls when dealing with variables within strings. When using double quotes, PHP will parse variables within the string, which can be useful but may also lead to unexpected behavior if not properly escaped. Single quotes do not parse variables, which can be more predictable but may require concatenation to include variables in the string. To avoid these pitfalls, it is important to understand the differences between double quotes and single quotes and use them appropriately based on the desired outcome.

// Example of using double quotes with variables
$name = "John";
echo "Hello, $name!"; // Output: Hello, John!

// Example of using single quotes and concatenation
$name = "John";
echo 'Hello, ' . $name . '!'; // Output: Hello, John!