PHP Manual Read notes (1)
1. Language Reference | Basic Syntax
? ? The end tag (?>) of the tail of the PHP file is best omitted to prevent extra spaces and carriage returns from the tail of the file
? ? You can use/*//, #方式的注释
?
2. Type
? ? Supports four types of scalars: Boolean, Integer, float (same as double), string
? ? supports two types of structures: Array, object
? ? Supports three special types: resource, NULL, callable
?
? ? Type does not have to be set, and PHP can derive itself from context during runtime.
?
<%php$a_bool = TRUE; $a _str = "str"; $a _str2 = ' str '; $an _int = 12;echo get_type ($a _bool); if (Is_int ($an _int)) { echo "Int";}
?
? ? Boolean:true/false, (bool), empty array is also FALSE
? ? Integer: Similar to C
? ? float: similar to C
? ? String: Single quotation mark, double quotation mark (variable expandable), variable expansion in Heredoc,nowdoc,heredoc, Nowdoc not expanded, Heredoc is <<<><>< p=""><><>
? ? Array: An ordered map that can be used as an array, a linked list, a hash table, and so on. Use Array () to create a comma-separated key=>value.
???????? Key can be an integer, or it can be a string, the contents of the string is an integer, will be converted to an integer, float to an integer, a Boolean to an integer, value can be any value.
The array () structure can be replaced with [] after php5.4.
????????. PHP array key can have both integers and strings, because PHP does not differentiate between indexed arrays and associative arrays.
? ? ? ? ? ? ? ?" Key = "can be omitted, using the previous largest integer key+1,key starting from 0.
When assigning values to array members, key can also be omitted: $arr [] = 24; This is also the largest integer key+1
? ? ? ? ? ? ? Unset deleting members
? ? ? ? ? ? ? foreach Loop: foreach ($arr as $item) {$item ...}
? ? Object: An instance of a class created with new classname. Class can have method,object->xxx () access method defined by function xxx ().
?
3. Variables
? ? Use $ start, case sensitive
?
4. Constants
? ? Define ("name", "value");
? ? const Hello = "Hello";
?