PHP HTML

HOW TO DISPLAY PHP VARIABLES IN HTML

<?php $var = "foo"; ?> <p><?php echo $var; ?></p>

PHP DELIMITERS

01

<?php $var = "foo"; ?> <p><?=$var?></p>

SHORT ECHO TAG

02

$first = "foo"; $second = "bar"; echo "<p>$first $second</p>";

ECHO HTML STRING

03

$person = [   "name" => "John Doe",   "email" => "john@doe.com" ];

PRINTF FUNCTION

04

foreach ($person as $k=>$v) {   printf("<div><strong>%s:   </strong> %s</div>", $k, $v); }