Christian Kruse: When to use " '?

Beitrag lesen

你好 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

再见,
 克里斯蒂安