PHP HTML

HOW TO USE PHP HTML ON SAME PAGE

PHP DELIMITERS

01

<?php THIS PART IS PHP $foo = "bar"; THIS PART IS HTML ?> <h1>HELLO</h1> <p>FOO BAR</p>

SHORT ECHO TAGS

02

<?php $foo = "bar"; ?> QUICKLY OUTPUT PHP VARIABLES WITH <?=$VAR?> <h1><?=$foo?></h1>

ECHO HTML TAGS

03

ARRAY DATA $foo = ["FOO", "GOO", "KOO"]; GENERATE HTML echo "<ul>"; foreach ($foo as $f) {   echo "<li>$f</li>"; } echo "</ul>";

INCLUDE & REQUIRE

04

FILE 1 - FOO.PHP echo "<strong>HELLO WORLD!</strong>";

FILE 2 - USE "FOO.PHP" <h1>FOO</h1> <p><?php require "FOO.PHP"; ?></p>