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
2. script style. pay attention to the language attribute settings.
3. short style
4. ASP style
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
The first sentence is to set the basic encoding format.