How to create HTML table in PHP
Notes:
HTML table layout in PHP
Indenting the code properly will increase readability, understandability and modifiability of the code.
Example code:
<?php
echo "<table border='0' width='300' cellspacing='0'>";
echo "<tr bgcolor='orange'>";
echo "<td>1</td>";
echo "<td>2</td>";
echo "<td>3</td>";
echo "<td>4</td>";
echo "</tr>";
echo "<tr bgcolor='lightgray'>";
echo "<td>1</td>";
echo "<td>2</td>";
echo "<td>3</td>";
echo "<td>4</td>";
echo "</tr>";
echo "<tr bgcolor='orange'>";
echo "<td>1</td>";
echo "<td>2</td>";
echo "<td>3</td>";
echo "<td>4</td>";
echo "</tr>";
echo "<tr bgcolor='lightgray'>";
echo "<td>1</td>";
echo "<td>2</td>";
echo "<td>3</td>";
echo "<td>4</td>";
echo "</tr>";
echo "</table>";
?>
Interview Questions:
1. PHP stands for ______________
a. Hypertext Preprocessor
b. Preprocessor Hypertext
c. Personal Home Processor
d. Personal Hypertext processor
Ans: a