Thursday, April 9, 2009

Using the echo <<<

Have you ever had the case where you need to echo a lot of things in PHP, but using the echo function just took too long because of all the quotes and stuff. Well there is a way to to echo things in PHP that makes it a lot easier. It is called the "here document" syntax:



The END (any word actually works) on the first line acts a document terminator to tell when the text has stopped. So the the the last line can't have anything else on it except for END

For example:



See this link for more details.

No comments: