Can we create html codes with php?

Asked By 10 points N/A Posted on -
qa-featured

I heard today that one of my friends talking where we can create HTML code within PHP.

Is this possible?

SHARE
Answered By 45 points N/A #109819

Can we create html codes with php?

qa-featured

Hello Ryan.

Use PHP echo.

echo outputs strings.  If an HTML tag is used, it will output the string as HTML.

Below is the link to the PHP function (or language construct) echo : http://it.php.net/manual/en/function.echo.php

It is one of the most basic functions in PHP which outputs strings.  It also support HTML tags.  

All you have to do is to enclose the string that you want to display and include HTML tags.

This is an example of using echo to output HTML:

<?php

Echo "<html>";
 Echo "<title>Using echo to output HTML in PHP</title>";
 Echo "Example of HTML bold tag</b>";

?>

The tags "<title>" and "" will be interpreted as HTML.  Try it out.

Hope this helps!

Related Questions