# A simple arithmetic example

## Contents |

#### Numeric types

- Whole numbers, called
*integers*(50, -1). - Decimal numbers, called
*floating point numbers*(0.66667, -1.99998).

#### Arithmetic operators

- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
- Modulo, or remainder (%)

#### Combined assignment operators

- Addition (+=)
*$num += 4*is the same as*$num = $num + 4* - Subtraction (-=)
*$num -= 4*is the same as*$num = $num - 4* - Multiplication (*=)
*$num *= 4*is the same as*$num = $num * 4* - Division (/=)
*$num /= 4*is the same as*$num = $num / 4* - Contatenation (.=)
*$String .= "hello"*is the same as*$string = $string."hello"*

#### Autoincrement and autodecrement

- Increment:
*$n++*is the same as*$n = $n+1* - Decrement:
*$n--*is the same as*$n = $n-1*

#### PHP Table Example

Write a PHP script that displays a table showing the result of applying the various arithmetic operators to a variable. The output should looks something like:

n | m | Operation | Result |
---|---|---|---|

10 | 3 | $n+$m | 13 |

10 | 3 | $n-$m | 7 |

Click here for a solution.