Page 1 of 1

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

Posted: Fri Jul 16, 2004 1:43 am
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?

Posted: Fri Jul 16, 2004 1:55 am
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]