- Assignment Operators
- Arithmetic Operators
- Comparison Operators
- String Operators
- Combination Arithmetic & Assignment Operators
Example:
$my_var = vn4000;
Arithmetic Operators
Operator | English | Example |
---|---|---|
+ | Addition | 2 + 4 |
- | Subtraction | 6 - 2 |
* | Multiplication | 5 * 3 |
/ | Division | 15 / 3 |
% | Modulus | 43 % 10 |
Comparison Operators
Comparisons are used to check the relationship between variables and/or values.
Operator | English | Example | Result |
---|---|---|---|
== | Equal To | $x == $y | false |
!= | Not Equal To | $x != $y | true |
< | Less Than | $x < $y | true |
> | Greater Than | $x > $y | false |
<= | Less Than or Equal To | $x <= $y | true |
>= | Greater Than or Equal To | $x >= $y | false |
String Operators
The period "." is used to add two strings together. Example
<?php
$a_string = "Hello";
$another_string = " vn4000";
$new_string = $a_string . $another_string;
echo $new_string . "!";
?>