PHP Lesson 1: Understanding PHP

Source: Internet
Author: User

PHP Lesson 1: Understanding PHP


Target Planning:
Through the first lesson, we can understand the php environment.

1. Environment Awareness:
2. access method:
3. Modify and view the code.
4. Use of Variables
5. Code indentation must have a hierarchical relationship, and it is best to keep blank lines between codes.
6. variable naming:
7. Output of variables:
8. Three Methods of variables:


1. Environment Awareness:

Software: http://download.csdn.net/detail/junzaivip/7697331

The installation tutorial is very simple. You can click here on your own

Directory structure after installation:



<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + signature + 1rG909Ta5K/Signature/ybfDzso8L3A + signature/tC48L3A + CjxwPs7Sw8e/Signature + signature + sLro7o8L3A + Signature = "brush: java;">

 ";echo "Hello world";echo "/html";?>
Recommended syntax

 
 
 


4. Use of Variables
 


5. Code indentation must have a hierarchical relationship, and it is best to keep blank lines between codes.

6. variable naming:
. Try not to use Chinese Characters
. Try not to start with a number
. Try not to use meaningless letters
. Variable names are case-sensitive. function names are case-insensitive and class names cannot be case-sensitive.
6. 5. The variable definition must be added with $

7. Output of variables:
Echo $ name;


8. Three Methods of variables:
Echo ($ name); // output variable
Var_dump ($ name); // output array, and print type and length
Print_r ($ name); // output Array


Example:

 

Shown below


Through the above display, we can see that the display is very unattractive and does not need to be read, so the formatting output scheme is as follows:
 "; Print_r ($ arr); echo"
";?>

The result is as follows:


TIPS:

Utf-8 encoding, a Chinese character is 3 Characters

Gbk encoding, a Chinese character is 2 Characters


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.