Re: Embedding foreach loops
| From: | Ben Dunlap | Date: | Mon, 10 Aug 2009 23:22:38 +0000 |
| Subject: | Re: Embedding foreach loops | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296586@lists.php.net to get a copy of this message | ||
> I am using the print function to display my html. I cannot get the line
> return ( \n ) character to actually push the html onto the next line, it
> just gets displayed instead. Should I be using echo?
In the PHP code snippet you pasted above, you're using single-quotes
to delimit your literal strings. In-between single-quotes, '\n' is not
converted to a newline character. It's interpeted completely
literally:
http://us.php.net/manual/en/language.types.string.php#language.types.string.syntax.single
Also, are you looking to insert a line break into the HTML itself --
just to keep your HTML code clean -- or into the visible page that's
rendered from the HTML? Because newlines don't have any significance
in HTML. You'd need to insert a <br /> or close a block-level element
to get the effect of a line-break in the visible page.
Ben