17 Variable Declared Incremented Before Display Incremented After Display Displaying Incremented Value.. 19[r]
Trang 11
Trang 22
Trang 3Setting the environment
– Local
– Global
– Static
– Type Determination
3
Trang 4• Operators in PHP
4
Trang 5• Operators are used to perform operations on
variables and values.
• PHP divides the operators in the following groups :
Trang 6• Arithmetic Operators:
with numeric values to perform common
subtraction, multiplication etc
– +, - ,*, /, %, **
Trang 7• Assignment Operators:
used with numeric values to write a value
to a variable.
is "=" It means that the left operand gets set to the value of the assignment expression on the right.
– =
Trang 88
Trang 9designed for strings
• , .=
• $a=“abcd”.”efgh”; $a=abcdefgh
• $a.=“ijk”; $a=abcdefghijk
Trang 10Operators:
Trang 11First
Variable
Second Variable
Concatenation
Using =
Trang 1212
Trang 13Adds $b in $a Concatenates $b with
$a
Trang 1414
Trang 15• The PHP increment operators are used
to increment a variable's value.
• The PHP decrement operators are used
to decrement a variable's value.
– ++ ,
• $b=$a++
• $b=++$a
Trang 1616
Trang 17Variable Declared Incremented Before Display
Incremented After Display
Displaying Incremented Value
Trang 1818
Trang 19combine conditional statements
– AND, OR, NOT, XOR
– &&, ||, !
Trang 20Logical Operators: