PHP Knowledge points-Personal notes

Source: Internet
Author: User
Tags scalar type null

# 2015-04-03
# #php知识点

-Variable definition $ definition
-Check whether variables are defined isset ()
-Check whether constants are defined, define a constant define ()
-delete a variable, destroy the Set Variable unset ()
-Check if the variable is set to empty ()

---
-Variable variable: variable name of a variable can be set and used dynamically
' $a = ' hello '; $ $a = ' world '; ${$a} = ' Hello World '

---

-Variable Assignment: 1 direct assignment, 2 variable indirect assignment, 3 reference assignment

---

-Copy is the original variable content copied down, the copied variables and the original variables using their own memory, non-interference. ' $a = $b; '
-the reference is the alias of the variable, which actually accesses the same variable with a different name, and when the value of one of the variables is changed, the other changes as well. ' $a = & $b; '

---

-8 types of raw data are supported in PHP:
-Boolean, Interger,float/double, string
-Array, Object
-Resource, null (two special types)

---

-What is considered false when converting a Boolean type to another type
-Boolean value false, shaped value 0, float type 0.0, blank string, string ' 0 ', empty array, special data type NULL, no variable set.

-Empty () in which case returns true
-Boolean value false, shaped value 0, float 0.0, blank string, string ' 0 ', empty array, no attribute object, variable not assigned

---

-String to Integer: Coercion type conversion:
-(shaping) string variable name;
-Direct conversion: Settype (string variable, shaping);
-Intval (string variable);

---

Scalar data: boolean,interger,float,double,string

---

1. Common system built-in constants: __file__,__line__,php_os,php_version
2. If two identical constants are defined, only the former works, since constants cannot be redefined or undefined once they are defined.
3. The difference between constants and variables
1. No $ sign in front of constants
2. Constants can only be defined by define () and cannot be evaluated by an assignment statement
3. Constants can be defined and accessed anywhere, while variables have global and local points
4. Constants once defined cannot be redefined or canceled, variables can be assigned to redefine
5. Constants can only be scalar data, variable types have 8 raw data types
4.9 pre-defined global array variables
1. $_post,$_get,$_request,$_cookie,
2. $_files,$_server,$_env, $GLOBALS

---
#2015-03-04
# #php知识点

-Variable definition $ definition
-Check whether variables are defined isset ()
-Check whether constants are defined, define a constant define ()
-delete a variable, destroy the Set Variable unset ()
-Check if the variable is set to empty ()

---
-Variable variable: variable name of a variable can be set and used dynamically
' $a = ' hello '; $ $a = ' world '; ${$a} = ' Hello World '

---

-Variable Assignment: 1 direct assignment, 2 variable indirect assignment, 3 reference assignment

---

-Copy is the original variable content copied down, the copied variables and the original variables using their own memory, non-interference. ' $a = $b; '
-the reference is the alias of the variable, which actually accesses the same variable with a different name, and when the value of one of the variables is changed, the other changes as well. ' $a = & $b; '

---

-8 types of raw data are supported in PHP:
-Boolean, Interger,float/double, string
-Array, Object
-Resource, null (two special types)

---

-What is considered false when converting a Boolean type to another type
-Boolean value false, shaped value 0, float type 0.0, blank string, string ' 0 ', empty array, special data type NULL, no variable set.

-Empty () in which case returns true
-Boolean value false, shaped value 0, float 0.0, blank string, string ' 0 ', empty array, no attribute object, variable not assigned

---

-String to Integer: Coercion type conversion:
-(shaping) string variable name;
-Direct conversion: Settype (string variable, shaping);
-Intval (string variable);

---

Scalar data: boolean,interger,float,double,string

---

1. Common system built-in constants: __file__,__line__,php_os,php_version
2. If two identical constants are defined, only the former works, since constants cannot be redefined or undefined once they are defined.
3. The difference between constants and variables
1. No $ sign in front of constants
2. Constants can only be defined by define () and cannot be evaluated by an assignment statement
3. Constants can be defined and accessed anywhere, while variables have global and local points
4. Constants once defined cannot be redefined or canceled, variables can be assigned to redefine
5. Constants can only be scalar data, variable types have 8 raw data types
4.9 pre-defined global array variables
1. $_post,$_get,$_request,$_cookie,
2. $_files,$_server,$_env, $GLOBALS
5. Actual development, constants used to
1. Connect the database information, such as the database server's user name, password, database name, host name
2. Define a partial path to a site as a constant, such as the Model,view folder path
3. Public information of the website, such as website name, website keywords, etc.

6. Advantages of functions
1. Improve the maintainability of the program
2. Reliability of the Software
3. reusability of programs
4. Development efficiency of the program

7. Definition of functions
1. Using the Function keyword
2. Function naming rules and variables, beginning with a letter or underscore, cannot begin with a number
3. Case insensitive
4. Function name can not use declared or system self-built function names

8. Depending on the visibility of variables, variables are divided into local variables and global variables, and a global variable is defined.

PHP Knowledge points-Personal notes

Related Article

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.