php script is surrounded by which delimiter

(*-*)浩
Release: 2023-02-24 20:08:01
Original
3404 people have browsed it

php scripts are surrounded by delimiters. Any content outside a pair of opening and closing tags will be ignored by the PHP parser, which allows PHP files to have mixed content.

php script is surrounded by which delimiter

You can embed PHP into an HTML document, as shown in the example below. (Recommended learning: PHP Programming from Beginner to Master)

<p>This is going to be ignored by PHP and displayed by the browser.</p>
<?php echo &#39;While this is going to be parsed.&#39;; ?>
<p>This will also be ignored by PHP and displayed by the browser.</p>
Copy after login

This will run as expected,

because when the PHP interpreter encounters the ?> end tag, it is simple Output the following content as it is (unless it is immediately followed by a newline - see command delimiter) until it encounters the next start mark; The exception is in the middle of a conditional statement, at which time the PHP interpreter will determine which Output, which ones to skip. See example below.

Use conditional structure:

Advanced separation using conditions

<?php if ($expression == true): ?>
  This will show if the expression is true.
<?php else: ?>
  Otherwise this will show.
<?php endif; ?>
Copy after login

In the above example, PHP will skip the paragraphs where the conditional statement is not reached, even if This paragraph is outside the PHP opening and closing tags. Since the PHP interpreter will directly skip the conditional statement block if the condition is not met, PHP will ignore it based on the condition.

When you want to output a large piece of text, it is usually more efficient to jump out of PHP parsing mode than to output the text through echo or print.

You can use four different pairs of opening and closing tags in PHP.

Two of them, and are always available.

The other two are short tags and ASP style tags, which can be turned on or off in the php.ini configuration file. Although some people find short tags and ASP-style tags convenient, they are less portable and generally not recommended.

Note:

Also note that if you embed PHP into XML or XHTML you will need to use the tag to maintain standards compliance.

The above is the detailed content of php script is surrounded by which delimiter. 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