PHP Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 3.00

Expressions, Operations and Type Conversions

This chapter provides tutorial notes and example codes on PHP expressions and operations. Topics include writing expressions with data literals, variables, and operations; bitwise, arithmetic, comparison, logical, string, and assignment operations; precedence of operations; data type automatic conversions.

What Is an Expression?

What Is an Operation?

Precedence of Operations

Data Type Automatic Conversion

Conclusion:

  • PHP supports 6 basic types of operations: bitwise, arithmetic, comparison, logical, string, and assignment operations.
  • PHP performs automatic type conversion, if an operand has a data type that does match the operator.
  • Write your expressions properly with operand data types match operators to avoid automatic type conversion.

Dr. Herong Yang, updated in 2009
Expressions, Operations and Type Conversions