HTML Tags Print with PHP Echo Statement

HTML is Hypertext markup Language. Now in this session we will use HTML tag with in echo statement. In PHP, we use echo statement to print the any message or display any output. We use different tags with echo statement then our outputs or message more attractive and meaningful.

We can use HTML special chars or HTML entities to display the HTML tags in echo statement.

We know that many tags in HTML for e.g. <b></b> (bold tag), </br> (break tag), <h1></h1>……<h6></h6> display for big heading.

Code:

<?php

// ALL HTML tags and description in echo statement
// All HTML tags comes in angular bracket < >, i.e. <html> <h1> <br> <small> <p> <a>

echo "b : It makes text bold.<br>";
echo htmlspecialchars(‘<b></b>’);
echo "<br>";

echo "h1 to h6 :HTML headings <br>";
// h1 for small size, h2 big size & so on
echo htmlspecialchars(‘<h1></h1>’);
echo "<br>";

echo htmlspecialchars(‘<h2></h2>’);
echo "<br>";

echo htmlspecialchars(‘<h3></h3>’);
echo "<br>";

echo htmlspecialchars(‘<h4></h4>’);
echo "<br>";

echo htmlspecialchars(‘<h5></h5>’);
echo "<br>";

echo htmlspecialchars(‘<h6></h6>’);
echo "<br>";

echo htmlspecialchars(‘<p></p>’). ‘:Describe a paragraph<br>’;
echo "<br>";

echo htmlspecialchars(‘<br />’). ‘:Inserts a single line break<br />’;
echo “<br>”;

echo htmlspecialchars(‘<small></small>’). ‘:for smaller text<br>’;
echo "<br>";

echo htmlspecialchars(‘<strong></strong>’). ‘:for Describe important text<br />’;
echo "<br>";

echo htmlspecialchars(‘<sub></sub>’). ‘:Describe subscripted text<br />’;
echo "<br>";

echo htmlspecialchars(‘<sup></sup>’). ‘:Describe superscripted text<br />’;
echo "<br>";

echo htmlspecialchars(“<table></table>”). ‘:Describe a table<br />’;
echo "<br>";

echo htmlspecialchars(“<th></th>”). ‘:Describe a header cell in a table<br />’;
echo "<br>";

echo htmlspecialchars(“<tr></tr>”). ‘:Describe a row in a table<br>’;
echo "<br>";

echo htmlspecialchars(“<td></td>”). ‘ :Describe a cell in a table<br />’;
echo "<br>";

echo htmlspecialchars(“<div></div>”). ‘:Describe a section in a document<br />’;
echo "<br>";

echo htmlspecialchars(“<textarea></textarea>”). ‘:Describe a multiline input control<br />’;
echo "<br>";

echo htmlspecialchars(“<button></button>”). ‘:Describe a click button<br />’;
echo "<br>";

echo htmlspecialchars(“<select></select>”). ‘:Describe a drop-down list<br />’;
echo "<br>";

echo htmlspecialchars(“<option></option>”). ‘:Describe an option in a drop-down list<br/>’;
echo "<br>";

echo htmlspecialchars(“<label></label>”). ‘:Describe a label for an input element<br />’;
echo "<br>";

echo htmlspecialchars(“<ul></ul>”). ‘:Describe an unordered list<br />’;
echo "<br>";

echo htmlspecialchars(“<ol></ol>”). ‘ :Describe an ordered list<br />’;
echo "<br>";

echo htmlspecialchars(“<li></li>”). ‘:Describe a list item<br />’;
echo "<br>";

echo htmlspecialchars(‘<a></a>’). ‘:Describe a hyperlink<br />’;

?>

Result:
html-tags-php1
html-tags-php2




Leave a Reply

avatar
  Subscribe  
Notify of