This article will share with you the method of Embedding php code in html, which is very simple and practical. if you need it, you can refer to the following for an experienced PHP Web developer, this is a very easy task. But this is a problem for beginners who are new to the PHP programming language. So here we will introduce 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 preceding HTML code, print Hello in the PHP code. You need to use the <? Php?> Tags. Integrating PHP and HTML is very simple.
You can also compile more complex PHP code in HTML. <? Php tag and end with?> Tag.
More advanced code example:
Php html Integration
<? Php for ($ I = 1; $ I <= 5; $ I ++) {?>
- Item No <? Php echo $ I;?>
<? Php }?>
Output result:
Item No 1 Item No 2 Item No 3 Item No 4 Item No 5
The above is all the content of this article. I hope you will like it.