在 PHP 中,可以使用单引号或双引号表示一个字符串,例如:
$string1 = "This is a string using single quotes.";
$string2 = "This is a string using double quotes.";
在双引号字符串中,可以使用变量和转义字符,如:
$name = "John";
$age = 30;
$string3 = "My name is $name and I am $age years old.";
$string4 = "He said, "I love PHP!"";
在单引号字符串中,不能使用变量和转义字符,如:
$string5 = "My name is $name and I am $age years old.";
$string6 = "He said, "I love PHP!"";