1, the difference between single and double quotation marks
- Single quotes represent strings, double quotes can parse variables in a string, so if there are no variables, try to use single quotes to speed up parsing
- When a string needs a single or double quotation mark, you can replace it with an escape character
2, type conversion
- Type conversion via (Boolean)
- Type conversion via bool Settype (mix var, string type), conversion succeeds, returns true, otherwise false
- The difference between the two is that the original variable after a conversion, b after conversion, the original variable changed to become the converted Variable
3, detection data type,
- Use a series of functions such as is_bool to detect, such as whether the detection is a number, is_numberic to detect is not a number type
4, use define to define constants,
- The format is define (string Name,mix value,case_sentive); The last parameter indicates whether case sensitive, true indicates insensitive
- Use defined to determine whether or not to define
- System constants, commonly used __file__ to represent file paths
5, assigning values to variables,
- Reference assignment and direct assignment, the direct assignment is directly equal to, the reference assignment is represented by &, when the reference assignment, the value changes, the reference also changes
6, variables include local variables, global variables, static variables, the difference is
- Local variables are only useful inside functions
- Global variables are useful throughout the PHP file, but are useless in user-defined functions, and if you want to use them in custom functions, declare them with global before customizing them, as follows
<? $test = ' Hello Test '; function echotest () { global$test; Echo $test ;}
View Code
Tamping the basics of PHP learning-1