In PHP language, each statement should end with a semicolon. But there are also special cases, such as a closing mark after the statement, or the end of the entire PHP page.
Like C language or Perl language, PHP statements should end with a semicolon. But when encountering the delimiter closing flag, the system will automatically add a semicolon after the PHP statement.
So if we see a delimiter end sign after a PHP statement, then we do not need to add a semicolon after the PHP statement. (Recommended learning: PHP video tutorial)
Look at two examples:
<?php echo 'This is a test'; ?> <?php echo 'This is a test' ?>
The first statement ends with a semicolon, Because the second statement ends at the end mark of the delimiter, there is no need to add a semicolon.
Let’s look at another example:
<?php echo 'We omitted the last closing tag';
If the following is the end of the PHP program file, then at this time, we don’t even need to use the PHP settings Delimiter end tag (?>).
Because PHP encounters and starts parsing the PHP code. When it encounters ?>, it knows that the PHP code is over (the following is the HTML code). So, it doesn't matter if there is no ?> at the end of the code file.
The above is the detailed content of What symbol does a php statement end with?. For more information, please follow other related articles on the PHP Chinese website!