Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive.
PHP supports eight primitive types:
- Four scalar types:
- float (floating-point number, aka double)
- Two compound types:
- And finally three special types:
// Integers: decimal, octal or hexadecimal $Var = 123; // Floating point $Var = 1.3e4; // Arrays or vectors $Var = 123; // Text Strings $Var = "A Text String\n"; // Objects $Var = new oMyClass();
The scope of a variable is the context within which it is defined.
A constant is an identifier (name) for a simple value. That value cannot change during the execution of the script. A constant is case-sensitive by default. By convention, constant identifiers are always uppercase
There are two built-in constants,
FALSE (case-insensitive), which representthe two possible boolean values.
Expressions are the most important building stones of PHP. The most basic forms of expressions are constants and variables.
A very common type of expressions are comparison expressions. These expressions evaluate to either
These expressions are most commonly used inside conditional execution, such as
- Operator Precedence
- Arithmetic Operators
- Assignment Operators
- Bitwise Operators
- Comparison Operators
- Error Control Operators
- Execution Operators
- Incrementing/Decrementing Operators
- Logical Operators
- String Operators
- Array Operators
- Type Operators