Good morning I wonder if you can create items like h1
, h2
, div
or buttons in html from
You can write any HTML tag using the function echo
of PHP, even create your entire web, make cycles for creating lists, etc. The result when you consult tupagina.com/pagina.php will be all the resulting HTML code.
For example:
<?php
echo "<p>Hola Mundo</p>";
?>
Add that in addition to the output functions like echo
or print
, you can do "code breaks" to get html directly.
<?php
$var = 'foo';
echo '<h1>Este texto concatena el valor de una variable ' . $foo . '</h1>';
print "<h1>Este texto embebe el valor de una variable {$foo}</h1>";
if ($var == 'foo') {
?>
<h1>Esto es html</h1>
<?php
}
?>