Can we create html codes with php?

Asked By 10 points N/A Posted on -

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

Is this possible?

Answered By 0 points N/A #109819

Can we create html codes with php?


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 :

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:


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!

Login/Register to Answer

Related Questions