Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Beginners learn PHP

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "beginners learn PHP", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "beginners learn PHP" bar!

Goal planning:

Through the first lesson, we can understand the php environment.

1. Understanding of the environment:

two。 Access method:

3. Modify the code and view it.

4. The use of variables

5. Code indentation should be hierarchical, and it is best to leave blank lines between code

6. Variable naming:

7. Output of the variable:

8. There are three methods for variables:

1. Understanding of the environment:

Software download address: https://www.jb51.net/softs/24445.html

The installation tutorial is very simple. You can have a look at Baidu yourself.

Directory structure after installation:

two。 Access method:

Enter: localhost directly in the browser to access

3. Modify the code and view it.

We can modify the index.php in the directory www above

Php output html code:

Suggested writing method

4. The use of variables

5. Code indentation should be hierarchical, and it is best to leave blank lines between code

6. Variable naming:

6.1. Try not to use Chinese

6.2. Try not to start with a number.

6.3. Try not to use meaningless letters.

6.4. Variable names are case-sensitive, function names are not case-sensitive, and class names are not case-sensitive, simply variable names and function case-insensitive.

6.5. The definition of a variable must add $

7. Output of the variable:

Echo $name

8. There are three methods for variables:

Echo ($name); / / output variables

Var_dump ($name); / / output the array and print the type and length

Print_r ($name); / / output array

Example:

Display as follows

From the above display, we can see that the display is very unattractive and does not need to be read, so format the output scheme:

The display results are as follows:

A little knowledge:

When Utf-8 is encoded, a Chinese character is 3 characters.

When gbk is encoded, one Chinese character is 2 characters.

Thank you for your reading, the above is the content of "beginners learn PHP", after the study of this article, I believe you have a deeper understanding of the problem of beginners learning PHP, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report