basic PHP - how to put a HTML block into PHP code?

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

Post Reply
des.murphy
Forum Newbie
Posts: 7
Joined: Wed Jul 14, 2004 1:25 pm

basic PHP - how to put a HTML block into PHP code?

Post by des.murphy »

I want to put a block of HTML into my PHP code


such as

Code: Select all

$script="<a>this is the end</a>
<br>
or is this?";
How is this done?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

have you tried that?

You can also use the heredoc (<<<)

Code: Select all

<?php

$html =<<<STOP
<a href="whatever">$somevar</a>
STOP;

?>
[edit: fixed the heredoc a bit]
Post Reply