PHP script several markup parsing _ PHP Tutorial

Source: Internet
Author: User
PHP script parsing. What we want to introduce today is: 1. PHP scripts have four types of tags: short tags and asp tags, which are easy to use but have poor portability and distribution. they are generally not recommended. Note that if we want to introduce PHP to you today1. PHP scripts have four types of labels: short labels and asp labels, which are convenient but have poor portability and release performance. they are generally not recommended. Note that if you embed PHP into XML or XHTML, you need to use standard labels. <? Php?> To maintain compliance with standards.

A, standard tag: <? Php...?>

B. script tag: <script language = "php">... </Script>

C. Short tag: <? ... ?> You need to set short _ open_tag = on in php. ini. the default value is on, or the-enable-short-tags option is added during PHP compilation. (PHP 3 can also use the short_tags () function to activate short tags .)

D, asp labels (supported after PHP 3.0.4): <%... %> You need to set asp_tags = on in php. ini. the default value is off.

2. PHP script command separator: like C, java, or Perl, PHP needs to end the command with a semicolon after each statement except the last line (because the end mark implies a semicolon. If the last line of the file is omitted, the output buffer and include () or require () are used ()

3. PHP script annotation: PHP supports C, C ++, and Unix Shell (Perl) annotations. For example:

Single line comment ://,#
Multi-line comment :/**/

 
 
  1. <? Php
  2. Echo "This is a test"; // Single line comment (c ++ style ),
  3. /* Multi-line comment: single-line comment description 1: "//?> "Medium?> Valid,
  4. Single line comment description 2: "// </script>" </script> invalid */
  5. Echo "This is yet another test ";
  6. Echo "One Final Test"; # single line comment (shell style)
  7. ?>


Protocol 1 and PHP scripts have four types of labels: short labels and asp labels, which are convenient but have poor portability and release performance, and are generally not recommended. In addition, note that if PHP...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.