PHP entry: writing syntax and basic specifications

Source: Internet
Author: User
This article is an entry-level PHP application. It mainly includes the basic syntax and writing style of PHP, how to write PHP identifiers, and basic naming rules. A simple PHP example is provided at the end of the article.

This article is an entry-level PHP application. It mainly includes the basic syntax and writing style of PHP, how to write PHP identifiers, and basic naming rules. A simple PHP example is provided at the end of the article.

From the beginning of this year, I wanted to incorporate PHP into the course, but I had no choice but to perform many tasks. Although there are many things, I have decided to integrate PHP into the five classes, and the five classes are getting closer and closer to explaining PHP. how can I drag on?

PHP is a language with a large knowledge capacity. it can be used for 4 months to talk about PHP. Therefore, I have been struggling recently. what should I do with PHP in HTML5, it is also the basic logic of the course ~

PHP basic syntax and writing style

There are four PHP code writing styles.

1. standard style, also recommended in the industry

1

2. script style. pay attention to the language attribute settings.

1 Specific code: script

3. short style

1

4. ASP style

1 <% Code %>

Note that if you want to use a short or ASP-style code, you need to modify the corresponding configuration file (php. ini) and restart Apache after modification. The code to be modified is as follows:

Short_open_tag = On

Asp_tags = On

PHP identifiers and naming rules

Identifier writing method

$ + Variable name

Identifier naming rules

1. unlimited length

2. any letter, number, or underline, not starting with a number

3. variables are case sensitive, but function names are case insensitive.

4. the identifier does not need to be defined and can be used directly.

5. avoid the same variables and function names as much as possible (which may cause parameters passing and other problems)

6. do not use keywords or reserved words

A simple example of PHP

1234

The first sentence is to set the basic encoding format.

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.