4.3.7. Define the operators
From Computer Science
Revision as of 19:26, 7 November 2016 by Mr Russell (Talk | contribs) (Created page with "All programming languages have a number of essential operators. Operators are the commands that compare, affect (change) or calculate something. The following essential operat...")
All programming languages have a number of essential operators. Operators are the commands that compare, affect (change) or calculate something. The following essential operators are required byt he IB:
Comparison Operators
Comparison operators evaluate whether two variables are equal, and if not, how they are different:
| Operator | Name | PHP Syntax | Explaination | Usage example |
|---|---|---|---|---|
| = | Equals | == or === | Compares two numbers or strings to see if they are the same.
PHP: == converts the variables to the same data type and evaluates the values, while === evaluates both values and data type |
if ($x == $y) { do something } |
| ≠ | ||||
| < |
=, ≠, <, <=, >, >=, mod, div.