For an experienced PHP Web developer, this is a very easy thing to do. But this is a problem for beginners who are just beginning to touch the PHP programming language. So here's how to embed PHP code in regular HTML code.
Embed PHP code in regular HTML
Create a Hello script, named hello.php:
PHP Test<?php Echo '
Hello World
';?>
In the HTML code above, print Hello in the PHP code. Writing PHP code in HTML requires the use of <?php?> tags. Integrating PHP and HTML is a very simple thing to do.
We can also write more complex PHP code in HTML, which requires the use of <?php tag and end with?> tag.
More advanced Code Examples:
PHP HTML Integration
<?php for ($i =1; $i <=5; $i + +) {?>
Item No <?php echo $i;?>
<?php}?>
Output Result:
Item no 1Item no 2Item no 3Item no 4Item No 5
The above mentioned is the whole content of this article, I hope you can like.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.