Enter your Sign-on user name and password.

Forgot password?
  • Follow us on:
Loading video...

Start Learning Now

Our free lessons will get you started (Flash® 10 required).
Get immediate access to our entire library.

Sign up for Educator.com

Features Overview

  • Get on-demand access to our complete library
  • Search and jump to exactly what you need to learn
  • Track your progress
  • Download practice and lesson files
  • *Ask questions and get answers from our community & instructors

Expression & Operators

  • 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 into one.
  • 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.
  • Additional Resources:

Expression & Operators

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.

Computer Science: Introduction to PHP