When to use " '?
ben
- php
I read a tutorial and sometimes the author is using ' - sometimes ".
What is the difference?
Example:
if(isset($_GET['section']) AND ("admin" == $_GET['section'])) {
session_start(); }
if(isset($_GET['section']) AND ('admin' == $_GET['section'])) {
session_start(); }
Hi,
What is the difference?
the (number of) characters you have to escape. See the documentation.
Cheatah
你好 ben,
I read a tutorial and sometimes the author is using ' - sometimes ".
What is the difference?
The difference is, that variables and escape sequences will not get expanded in single quotes. So,
$var = "def"
echo "abc$var"
will print out abcdef, while
$var = "def"
echo 'abc$var'
will print out abc$var. That's the main difference. For more information have a look at http://www.php.net/manual/en/language.types.string.php
再见,
克里斯蒂安