Horizontal Repeat Loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

Yeah, it's called heredoc. Do some research on it if your interested. It also works with return and declaring variables. Eg:

Code: Select all

// declare a variable
$var = <<< END
this
means
war
END;
$var = nl2br($var);
echo $var;

// return from a function
function this($that) {
return <<< THAT
<p>$that</p>
THAT;
}
And, your welcome for the advice. Just don't go in and out of PHP too much - most of the time, you'll lose track.

-Nay
Post Reply