Math operators within PHP automatically calculate results based on which is used and the numbers input. Numbers can be either specified plainly in the code or assigned to variables.
Two variables have been created and assigned numbers, $num1 is 75 and $num2 is 3.
The first operator is addition, which calculates the sum of the inputs together as seen below.
78
The operation (+) was assigned to a new variable $sum which was echoed above
The second operator is subtraction, which calculates the difference of the inputs together as seen below.
72
The operation (-) was assigned to a new variable $diff which was echoed above
The third operator is multiplication, which calculates the product of the inputs together as seen below.
225
The operation (*) was assigned to a new variable $prod which was echoed above
The fourth operator is division, which calculates the quotient of the inputs together as seen below.
25
The operation (/) was assigned to a new variable $quot which was echoed above