December 9, 2016, Friday
first, Types of Variables:
1. Basic Type:
Integral type (integer);
Float type (float);
Strings (string);
Boolean type (boolean);
2. Composite type:
Arrays (array);
Objects (object);
3. Special Type:
NULL
Resource Type resource;
Note: if a string and a number are added, the string is automatically converted to a pure number, and then the addition is DONE.
If the strings are added, they are automatically converted to numbers and then Added.
second, variable:
definition: $ variable name;
note: variable name: can only be letters, numbers, underscores, cannot start with a number
Custom variables are case-sensitive
Writing variables: using small humps (onetwothree)
three, constant:
define ("constant name", constant value);
Note: The constant name is generally all uppercase;
Constant name: only letters, numbers, underscores, constant names cannot begin with a number, and can only be assigned once.
Iv. the difference betweenisset () and empty () :
Empty () determine if the value of a variable that has been defined is null {', 0, 0.0, [], false, ' 0 '}
isset () Determines whether a variable has a value (initialized );
v. Type conversion methods:
first: Change the value only, the type of the variable is the same
(type) $ variable Name
$a = ' 123abc ';
$b = (int) $a;
Echo $b;
Second: variable types are changed
Settype ($ variable name, "type")
$a = ' 123abc ';
$b = Settype ($a, "integer");
Echo $b;
Third: use system-provided functions (val-family Functions) to change only the value, without changing the variable type
boolval ($ variable Name)
doubleval ($ variable Name)
Floatval ($ Variable Name)
intval ($ variable Name)
strval ($ variable Name)
Basic knowledge of PHP (2)