Welcome
    

Basic Arithmetic Operations

 

 

Basic arithmetic operations in PHP involve fundamental mathematical operations such as addition, subtraction, multiplication, and division. These operations are often used for performing calculations and manipulating numerical data. Here's an overview of basic arithmetic operations in PHP:

 

 

Addition (+)

 

Adds two numbers together.

 

Example:

 

$a = 5;
$b = 3;
$sum = $a + $b;
// $sum is 8

 

Subtraction (-)

 

Subtracts one number from another.

 

Example:

 

$a = 10;
$b = 7;
$difference = $a - $b;
// $difference is 3

 

Multiplication (*)

 

Multiplies two numbers.

 

Example:

 

$a = 4;
$b = 6;
$product = $a * $b;
// $product is 24

 

Division (/)

 

Divides one number by another.

 

Example:

 

$a = 20;
$b = 5;
$quotient = $a / $b;
// $quotient is 4