PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Samuel Adeshina   Greens PHP Polygon Area   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Examples And How To
Class: Greens PHP Polygon Area
Calculate the area and perimeter of a polygon
Author: By
Last change: Fixed some runtime error
Date: 8 years ago
Size: 372 bytes


Class file image Download

$polygon = new Polygon();
$polygon->setVertices(new Point(0, 0), new Point(1.5, 0), new Point(2.5, -1), new Point(2, 5));

    echo (
$polygon->area()); //returns the area of the irregular polygonal shape
echo ($polygon->perimeter()); //returns the perimeter of the polygon (the distance around the polygonal shape or object)