PHP program to enter length and breadth of a rectangle and find its perimeter
ADVERTISEMENTS
PHP program to enter the length and breadth of a rectangle and find its perimeter.
There are you will learn how to find the perimeter of a rectangle in PHP language.
Formula:
P = 2(l + w)
where:
P
= perimeter
l
= length of the rectangle
w
= width of the rectangle
Let us understand this through the PHP program:
<?php
// PHP program to find the perimeter of a rectangle
$l = 5;
$w = 7;
$p = NULL;
// Calculate perimeter of rectangle
$p = 2 * ($l + $w);
echo "\nThe Perimeter of rectangle = " . $p . " units"
?>
Output:
The Perimeter of rectangle = 24 units