PDA

View Full Version : Resolved Does newline (\n) only work with double quotes?



jlizarraga
06-26-2009, 06:51 PM
EDIT: Yep, only works with double quotes. I didn't realize there were so many differences in single and double quotes in PHP - that is definitely going to come in handy in the future!

If you want to keep using single quotes, just do it with concatenation: $var = '$someLiteralString'."\n";

Hi all,

This is working for me:


echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://yui.yahooapis.com/2.7.0/build/container/assets/skins/sam/container.css\" />\n";

But this one prints the "\n" as text:


echo '<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/container/assets/skins/sam/container.css" />\n';

Do you HAVE to use double quotes with newlines? Could this be something specific to the PHP setup? I'm still new to PHP.

Thanks a bunch for any help.

bluewalrus
06-26-2009, 07:36 PM
Simplest thing I've figure is double quotes means render, single means leave it as is.