Arithmetic operators work just like those we learnt in school.

Example | Name | Result |
---|---|---|

-$a | Negation | Opposite of $a |

$a + $b | Addition | Sum of $a and $b. |

$a - $b | Subtraction | Difference of $a and $b. |

$a * $b | Multiplication | Product of $a and $b. |

$a / $b | Division | Quotient of $a and $b. |

$a % $b | Modulus | Remainder of $a divided by $b. |

<?php echo (5 % 3); echo '<br>'; echo (5 + 3); echo '<br>'; echo (5 - 3); echo '<br>'; echo (12 / 4); ?>

## Leave a comment