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

What symbol does a php statement end with?

(*-*)浩
Release: 2023-02-25 20:14:02
Original
7860 people have browsed it

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; ?>
Copy after login

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;;
Copy after login

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

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template