PHP syntax

PHP is a scripting language that runs on the server side and can be embedded in HTML.

PHP code markup

  • Throughout THE history of PHP, a variety of tags have been used to distinguish PHP scripts

    ASP tag: <% PHP code %>

    Short marker: <? The Php code? >, the above two basic deprecations, if you want to use it then need to enable in the configuration file

  • Script tags:<script language= "PHP" >

  • Standard flag (common) : <? PHP code? >

PHP comments

  • Habit: All code must be commented as it is written. For beginners, comments are a way of learning and writing code
  • There are two types of comments in PHP: line comments and block comments
  1. Line comment: one line at a time // : everything that follows is a comment # : the same as //
  2. Block comment: Comment multiple lines at a time

    / : middle up toBefore it came out, it was all comments

    * /