PHP first lesson simple to understand PHP

Source: Internet
Author: User


Goal Planning:
Through the first lesson, we can learn about the PHP environment.

1. Understanding of the environment:
2. Access method:
3. Modify the code and view.
4. Use of variables
5. Code indentation to have a hierarchical relationship, and the best between the code to keep blank lines
6. Variable Name:
7. Output of variable:
8. Three methods of variable:


1. Understanding of the environment:

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

Installation tutorial is very simple, you can own Baidu

Directory structure after installation:



<喎?http: www.2cto.com="" kf="" ware="" vc="" "="" target="_blank" class="keylink"> vcd4kpha+pc9wpgo8cd4ylrfdzsq3vbeoojwvcd4kpha+1rg909ta5k/awmb3yuti6zpsb2nhbghvc3qgvls/ybfdzso8l3a+ cjxwpjwvcd4kpha+my7q3rjetprc67ywsum/tc48l3a+cjxwps7sw8e/ydlu0n64xmnpw+bev8k8d3d31tc1xgluzgv4lnbocdwvcd4kpha+ Cghwyusz9mh0bwy0+slro7o8l3a+cjxwpjwvcd4kphbyzsbjbgfzcz0= "Brush:java;" >

 
  ";
echo "Hello World";
echo "/html";

? >
Suggested wording

 
 
  


4. Use of variables
 
  


5. Code indentation to have a hierarchical relationship, and the best between the code to keep blank lines

6. Variable Name:
6.1. Try not to use Chinese
6.2. Try not to start with numbers
6.3. Try not to use meaningless letters
6.4. Variable names are case-sensitive, function names are case-insensitive, class names are not case-sensitive, and simply variable names and functions are all lowercase.
6.5. Definition of variable must be added $

7. Output of variable:
Echo $name;


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


Example

 
  

Shows the following


Through the above display, we can see that the display is very beautiful, and do not read, so format the output scheme:
 
  ";
	Print_r ($arr);
	echo "
";?>

The results appear as follows:


Small knowledge:

Utf-8 encoding, a Chinese text is 3 characters

GBK encoding, one Chinese 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.