What is the difference between single-quoted and double-quoted strings in PHP?
What is the difference between single-quoted and double-quoted strings in PHP?
The main differences between single-quoted and double-quoted strings in PHP are:
$name = "John";
echo "Hello, $name!"; // Output: Hello, John!
echo 'Hello, $name!'; // Output: Hello, $name!
\n for newline, while single-quoted strings treat escape sequences literally. For example:echo "Hello\nWorld"; // Output:
//Hello
//World
echo 'Hello\nWorld'; // Output: Hello\nWorld
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.