84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
Why is it okay to use single quotes when constants are stored in variables? - PHP Chinese website Q&A - Why is it okay to use single quotes when constants are stored in variables? - PHP Chinese website Q&A
Take a look around and learn.
PHP单引号及双引号均可以修饰字符串类型的数据,如果修饰的字符串中含有变量(例$name);最大的区别是: 双引号会替换变量的值,而单引号会把它当做字符串输出。
例如:
<?php $name="string"; echo " 字符串" . '$name'; echo "字符串" . "$name"; ?>
结果:
字符串$name
字符串string
还有重要的一点点:单引号和双引号区别的意义
当所发送的数据中涉及到单引号和双引号时,在打印双引号时使用单引号,反之亦然,如:
echo 'She said,"How are you?"';
print "I'm just ducky.";
希望能帮到你
Why is it okay to use single quotes when constants are stored in variables? - PHP Chinese website Q&A - Why is it okay to use single quotes when constants are stored in variables? - PHP Chinese website Q&A
Take a look around and learn.
PHP单引号及双引号均可以修饰字符串类型的数据,如果修饰的字符串中含有变量(例$name);最大的区别是: 双引号会替换变量的值,而单引号会把它当做字符串输出。
例如:
结果:
字符串$name
字符串string
还有重要的一点点:单引号和双引号区别的意义
当所发送的数据中涉及到单引号和双引号时,在打印双引号时使用单引号,反之亦然,如:
echo 'She said,"How are you?"';
print "I'm just ducky.";
希望能帮到你