Example #1
0
<!DOCTYPE html>
<html>
<head>
    <title>Triangle</title>
</head>
  <body>
      <h1>What kind of triangle is it?</h1>
      <?php 
$get_side1 = $_GET["length1"];
$get_side2 = $_GET["length2"];
$get_side3 = $_GET["length3"];
$new_triangle = new Triangle($_GET["length1"], $_GET["length2"], $_GET["length3"]);
$is_triangle = $new_triangle->isTriangle();
$get_equilateral = $new_triangle->isEquilateral();
$get_scalene = $new_triangle->isScalene();
$get_isosceles = $new_triangle->isIsosceles();
if ($is_triangle) {
    if ($get_equilateral) {
        echo "<p>Your triangle is equilateral!</p>";
    } elseif ($get_scalene) {
        echo "<p>Your triangle is scalene!</p>";
    } else {
        echo "<p>Your triangle is isosceles!</p>";
    }
} else {
    echo "<p>This is not a triangle! Try again!</p>";
}
?>
  </body>
</html>