today's Course: PHP 3- Day Foundation Consolidation video Tutorial "Yan 18"
variable Type: String, Integer, floating-point number, resource, array, object, NULL, Array
Null type // No value and no type
<?php
$a = null;
?>
detects if a variable exists //isset detection variable, returns false for the null type
if (Isset ($b)) {
echo ' variable b exists ';
}else{
echo ' variable b does not exist ';
}
get the variable type //gettype function
$b = ' 1 ';
Echo GetType ($b);
determine if the type you want is //is_int,is_float,is_array ...
Is_int,is_float,is_array
if (Is_int ($a)) {
echo "A is shaping ";
}else{
echo "A is not cosmetic ";
}
print variable //echo string , Print_r array,var_dump The type of the variable and its value
echo string , Print_r array,var_dump type and value of the print variable
$c = 1;
$d = Array (+/-);
Echo $c;
Print_r ($d);
Var_dump ($d);
Type conversions
$a = 1;
$a = $a. ' Hello ';
echo $a;
to the Boolean type of judgment, the value is considered a Boolean false, while the other refers to the original true:',' 0 ',0,0.0,false, NULL,Array ();
if (' = = False ') {
Echo ' empty string is false ';
}
?>
Assign value
value Assignment,
$a = 9;
$w = 10;
$w = $a;
Var_dump ($a, $w);//29.29
$w = ' W ';
Var_dump ($a, $w);//29.W
Reference Assignment
$a = 9;
$w = 10;
$w = & $a;
Var_dump ($a, $w);//29.29
$w = ' W ';
Var_dump ($a, $w);//w.w
destroy variable // destroyed variable value is NULL
destroyed
$a = 9;
unset ($a);
if (Isset ($a)) {
echo ' variable a exists ';
}else{
echo ' variable a does not exist ';
}
Dynamic Variable Name
Dynamic Variable name
$a = ' Hebei ';
$d = ' a ';
$e = ' d ';
Echo $a, $ $d, $$ $e;
Arithmetic operators
echo ' <br/> ';
$a = 10;
$b = 1;
echo $a/$b;// divisor cannot be 0
echo ' <br/> ';
$a = -10;//10,-10
$b = -3;//3,-3
echo $a% $b;//modulo algorithm, the result is positive or negative depending on the divisor
Tired Today, sleep.
The third day, did not give up, it seems really need to go heart ~ ~ ~
This article from "A Big big waste fish" blog, declined reprint!
Abandoned fish--how long does PHP take to get from getting started to giving up? 3