Php 7 operators are used for Arithmetic and Calculations. It is also used for comparing values. If we used Php 7 for arithmetic and calculations we would be using add, subtract, multiply, divide, modulus and exponents. Here are files from the last lesson. Here are files for this lesson.

## Php 7 Arithmetic Operators Examples

- + adding numbers
- – subtracting numbers
- / dividing numbers
- * multiply numbers
- % modulus numbers
- ** exponents (
*indices in all other countries except the USA*)

### Adding Numbers Php 7 Operator

This is how we “**add**” numbers using the “**PHP 7 Operator**“.

<?php /*THIS IS SIMPLE ADDITION*/ $x = 2; $y = 3; echo $x + $y; ?>

### Subtracting Numbers Php 7 Operator

This is how we “**subtract**” numbers using the “**Php 7 Operator**“, now try this.

<?php /*THIS IS SIMPLE SUBTRACTION*/ $x = 9; $y = 5; echo $x - $y; ?>

### Multiply Numbers Php7 Operator

This is how we “**multiply**” numbers using the “**Php 7 Operator**“, so check this out.

<?php /*THIS IS SIMPLE MULTIPLICATION*/ $x = 3; $y = 5; echo $x * $y; ?>

### Divide Numbers Php 7 Operator

This is how we “**divide**” numbers using the “**Php 7 operator**“, now try this example.

<?php /*THIS IS SIMPLE DIVISION*/ $x = 8; $y = 4; echo $x / $y; ?>

### Modulus Php 7 Operator

Modulus is dividing a number, so if you have anything left over that is the “**modulus**“. This is how you do “**modulus”** in the “**Php 7 operator**“.

<?php /*THIS IS MODULUS IF YOU DIVIDE BY 2 NUMBERS AND HAVE ANYTHING LEFT OVER THAT IS YOUR MODULUS.*/ $x = 3; $y = 2; echo $x % $y; //ANSWER IS 1 ?>

### Exponents Php 7 Operator

To get exponents in Php 7 you will use the double asterix, (**). This is how you do “**exponents**” in the “**Php 7 Operator**“.

<?php /*IN THIS EXAMPLE WE ARE USING EXPONENTS 5 TO THE 3RD POWER THAT WOULD EQUAL 125*/ $x = 5; $y = 3; echo $x ** $y; ?>

## Conclusion Arithmetic Operators PHP 7

In order to understand a programming language you also need to understand the mathematics of that language. There are other operators that we will cover in the next lesson. I thought it was appropriate to break these lessons down to keep them simple. Next lesson we will use operators to compare two values. We will then show result based upon the comparison. PHP 7 operators are going to be a powerful arsenal in your programming toolbox.

We will be using the knowledge you gain here and apply it to our project PennsylvaniaWilds.org.

Like share and subscribe to these lessons so we can keep them free.

Please like, share and subscribe.

**Advanced Programming Made Easy**

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

Reoccuring Tips