<?php
echo "<table>";
echo "<tr>";
echo "<td>"."How to print/echo HTML tags in PHP."."</td>";
echo "</tr>";
echo "</table>";
?>
Now, here's how I do it now which I think is more efficient and HTML readable.
<?php
echo "
<table
<tr>
<td>"."How to Print/Echo HTML tags in PHP More Effeciently"."</td>
</tr>
</table>
";
?>
Notice the difference? In the first PHP sourcecode, I use the
echo
five times, while in the second one, I use only once. Using
echo
to print HTML tags is not expensive in terms of server resources, but if you're using it the way I did in the first example for all your pages and and you have thousands of users to your website, you'll see the difference.
0 comments:
Post a Comment