1. Embed PHP into HTML
PHP is an embedded language that can be used in combination with HTML, but in thousands of code, however, how to differentiate between HTML and PHP, PHP decomposition (tags) as pillar, exactly the beginning and end of the PHP script. There are four types of decomposition characters that allow PHP to be embedded in HTML.
(1) <?php and >:php standard decomposition.
(2) <,? and?: Shorthand for the decomposition of the character.
(3) <script language= "PHP" > and </script>:javascript/vbscript style decomposition characters
(4) <% and%>:asp decomposition characters.
The first and second are the most commonly used methods; The third approach is similar to JavaScript embedding, and the fourth approach is similar to ASP embedding.
Note: To use PHP to support < ><%%>, the following settings need to be set in the configuration file php.ini, respectively:
Short_open_tag = on;
Asp_tags = on;
The content between a pair of decomposition characters "<" and ">" is PHP code, except that the inner wing is an element of HTML.
Terminator of PHP statements
The statement terminator in PHP is a semicolon ";", that is, after each sentence of PHP code, you need to add ";" to indicate the end of the statement.
PHP is case sensitive, ignoring whitespace in the statement, tabs, carriage returns, which can make the program have a good indentation style.