 # PHP Program to calculate the area of the rectangle

## Area of a rectangle

A rectangle has four sides where two adjacent sides are equal. The area of a rectangle is calculated by multiplying the length of the rectangle by the width of the rectangle. The area of a rectangle can be calculated by using the formula  'l * w' where l is the length of the rectangle and w is the width of the rectangle. For example, if the length of the rectangle is 7 and the width of the rectangle is then the area of the rectangle will be '5 * 7 = 35'

## How to find the areal of the rectangle using PHP

In this program, we are using the direct method to find the area of the rectangle. Here we accept the values of length and the width of the rectangle into the variables l and w from the user. After storing the values in variables we compute the 'l * w'  to get the area and assign the result into the variable a and print the value of the variable as the area of the rectangle.

### ALGORITHM

Step 1: Accept the value of the length and the width of the rectangle into the variables l and w

Step 2: Assign the computed value of 'l * w' into the variable a

Step 3: Print the value of the variable a as the area of the rectangle

## PHP Source Code

```                                          ```<?php
\$l = readline("Enter the length of the rectangel: ");
\$w = readline("Enter the width of the rectangle: ");
\$a = \$l * \$w;
echo "Area of the rectangle is \$a";
?>```
```

## OUTPUT

```Enter the length of the rectangel: 9
Enter the width of the rectangle: 5
Area of the rectangle is 45```
VIEW ALL
VIEW ALL
##### OtherTutorials
VIEW ALL 