Comments for PHP
1.//
2.#
3./* * *
Variable
A variable is a container for storing information;
Variable rule:
1. The variable begins with $, followed by the name "" $sum;
2. The variable must begin with a letter or a slide, and cannot begin with a number;
3. Variable name is case-sensitive "" $q is not the same as $q;
PHP Data type
Four types of scalar:
1.Boolean (Boolean) "True False;
2.Integer (integral type) "" No decimal number, plus or minus can be;
3.Float (floating point type) "There is a decimal or exponential form of existence;
4.String (String) "text";
The difference between a php single quote and a double quote
1. "" Will analyze if there is a variable, if there is a variable to parse the variable and then output the string;
2. "Direct output string;
PHP Two types of composite
1.array (array) stores multiple values in a variable; $arr =array (...)
2.object (object) objects are data types that store data and about how the data is processed;
Two special types of PHP
1.resource (resources);
2.NULL;
PHP Constants
Constants are identifiers of a single value, beginning with a character or underscore;
Define (' Constant name ', ' value ', false/true) ' false does not distinguish between constant name case, true distinction;
The PHP operator
+-*/%;
Assignment operators
1. $x = $y "" Assigns the value of Y to X;
2. $x + = $y "" $x = $x + $y;
3. $x-= $y;
4. $x *= $y;
PHP character Join operation
1.. connector;
2. = Assignment Link "" $a = ' xxxx '; $b = ' yyy '; $a. = $b; $a = ' xxxyyy ';
PHP Increment decrement operator
+ + $x before incrementing $x plus 1 increments and then returns $x;
$x + + after the increment first return $x and then add 1 increment;
--Diminishing before $x;
$x--diminishing after;
PHP comparison Operators
= = equals $x = = $y;
= = = Congruent (exactly the same, the same type);
!== not congruent (completely different);
! = range;
<> range;
> Greater than;
< less;
>= is greater than or equal to;
<= less than or equal to;
PHP logical operators
and with;
Or or $x or $y at least one is true to return true;
XOR is different or has only one and has a true return true;
&& and;
|| Or
! No! $x returns True if $x is not true;
PHP conditional statements
if (condition)
{
...... Meet the conditions of implementation;
}
Else
{
...... Do not meet the conditions of implementation;
}
Switch ()
{
Case ():
...... ;
Break
Default
......;
}
PHP comments, variables, types, constants, operators, comparators, conditional statements;