You can use HTML tags within the PHP echo statement. The purpose of an echo statement is to send information to the browser, and if you want to embed HTML tags or other content (such as CSS or JavaScript) that is readable by Web browsers, you are free to do so. For example, change the preceding echo line to this:
echo "This is <strong>PHP</strong> code";
In this line, you are using the HTML <strong> tag to make a part of the echo statement bold. This is an incredibly useful and often used feature in PHP.Remember that you can only put HTML tags inside legitimate PHP commands.
You can’t just dump HTML inside a PHP block like this:
<?php
<strong>Boogaloo with my didgeridoo</strong>
?>
<strong>Boogaloo with my didgeridoo</strong>
?>
Everything inside the <?php and ?> tags is expected to be PHP, and the <strong> tags are HTML (not PHP).
0 comments:
Post a Comment
We really appreciate if you comment after reading our posts. Thank You