In this lesson our instructor talks about expression and operators. First, he discusses expressions, operators, assignment operators, arithmetic operators, and increment operators. Then he talks about decrement operators, combined assignment operators, string operators, precedence and associativity. He ends the lesson with a helpful homework challenge.
An expression is anything in PHP that has a value.
An operator takes one or more expressions, called operands , and
performs some operation on them to yield another expression.
Operators can be divided according to how many values they operate on:
unary operators: single value
binary operators: two values
ternary operators: three values
Assignment operators(=, =>) are binary operators used to
assign the value of one expression to another expression .
There are arithmetic operators for addition, subtraction, multiplication,
division, and negation. There is also the modulus (%) operator used for
getting the remainder of a division operation.
The increment/decrement operators are used to increment or decrement their
operand by one. They come in both pre and post forms.
The concatenation operator(.) is used to combine two strings
PHP provides combined assignment operators for all of the binary
arithmetic operators, as well as the concatenation operator.
Operators have both a precedence and associativity .
When an expression contains multiple operations, the operations with higher
precedence are completed first. If an expression contains two operations of
equal precedence , then the associativity of the operations
determines which operation is completed first.
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.