Home  >  Article  >  Backend Development  >  What symbol does a php statement end with?

What symbol does a php statement end with?

(*-*)浩
(*-*)浩Original
2019-10-08 13:51:567804browse

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.

What symbol does a php statement end with?

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 &#39;This is a test&#39;;
?>
<?php echo &#39;This is a test&#39; ?>

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 &#39;We omitted the last closing tag&#39;;

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 01c1d37f0c1b7d7a648646ec4f9ebdb7, 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn