How to use HTML code within PHP with easy steps | Html code in Php
|Html code in Php|
Here in this article, we will discuss how to write HTML code in PHP step by step and I will also discuss what are different Opening and closing tags to different programmer’s uses in their PHP opening and closing tags. So let’s discuss HTML embed in PHP code. How to write HTML code in PHP with easy steps.
How to write HTML code in PHP
Now you have to write your PHP script, for example, you will write echo “I am Saeed Developer “ ;
In the echo statement, you will write any text or variable in the single quotes (‘ ‘) or double quotes (“ “). Whatever you will write in the single or double quotes this will print on the page. You can use print statement instead of echo statement, print statement is used the same as echo statement.
So if you use HTML tags in the echo statement in the quotes this will also run. For example echo “<b> I am Saeed Developer </b>” ; and ends your PHP tag ?> then this will give you this output
I am Saeed Developer
Follow the steps to embed your HTML code in PHP tags and code.
- First of all write your php opening tag: <?Php
- Now you will use echo or print function of php like this: echo “ “;
- Put the text or variable in the quotes for example: echo “ We are Humans “;
- Now give HTML tags to echo statement: echo “ <h3> We are Humans</h3>”;
- Now close the php tags: ?>
This h3 tags is HTML heading tag used in this PHP echo statement
The exact statement will be this so that you understand better.
echo “ <h3> We are Humans</h3>”;
This will run on all computers and anywhere else on PHP servers.
You can use any HTML tags in this way just change HTML tags you will see the results. I will discuss in the next post how to use variables in PHP code.
Now I will discuss other PHP opening and closing tags using by different programmers.
- First and best PHP tags this is a universal tag and considers best.
echo “ I am Here“;
This is best because it is a universal method and PHP file will run automatically on your Xampp or Wamp servers and other online or offline platforms. Now discuss other methods using by different programmers these methods may require some changes in the php.ini file to run these types of opening and closing tags.
- A second method that is used by some other programmers in their coding while coding in PHP
echo “I am here ”;
- The third method used by different programmers to giving php opening and closing tags
”I am here”
- ASP style PHP opening tags and closing tags using by php programmers
“I am here”
- Other ASP style PHP opening tags using by programmers while coding in PHP programming language.
echo “I am here”;
- HTML style PHP tags using by programmers while coding in PHP
<script language= “php”>
echo “ I am here “;
Important Note: Html code in Php
You can only use PHP other programmers used methods if you configured in PHP.INI file this PHP ini file have different modules and settings to turn on or off. When we start a web server it takes all settings from php.ini so you will do all settings in your server and restart your server otherwise these settings will not work.
How to find Php.ini file using XAMPP
So if you want to configure PHP with ISS then see this
Don’t worry about these configurations I will discuss these in future posts I will also discuss two methods of PHP one the universal method of PHP <?php ?> and <?= ?>.
Final words about Html code in Php
If you understand how to use HTML in the PHP programming language it is best for me because my main intention was to show you how to use HTML code in PHP. I also discuss different PHP programing language opening and closing tags and methods of use. Where to change the method of PHP ini file setting and find your php.ini file how to write HTML code in PHP
Give me feedback on Html code in Php
Please provide me feedback if you like this article let me know how I can improve this you can give me feedback in the comment section. I will be happy to see your comment and I can provide the quality content and helpful content f
You may like this content: HTML Tutorials