return $this->side3;
    }
}
$my_triangle = new Triangle($_GET["side1"], $_GET["side2"], $_GET["side3"]);
?>

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <title>What Triangle Is It?!</title>
</head>
<body>
    <div class="container">
        <?php 
$inputtedSide1 = $my_triangle->getSide1();
$inputtedSide2 = $my_triangle->getSide2();
$inputtedSide3 = $my_triangle->getSide3();
if ($inputtedSide1 + $inputtedSide2 <= $inputtedSide3 || $inputtedSide2 + $inputtedSide3 <= $inputtedSide3 || $inputtedSide1 + $inputtedSide3 <= $inputtedSide2) {
    echo "<h1>This is not a triangle! GTFO!</h1>";
} elseif ($inputtedSide1 == $inputtedSide2 && $inputtedSide2 == $inputtedSide3) {
    echo "<h1>This is an equilateral triangle!</h1>";
} elseif ($inputtedSide1 == $inputtedSide2 || $inputtedSide1 == $inputtedSide3 || $inputtedSide2 == $inputtedSide3) {
    echo "<h1>This is an isosceles triangle!</h1>";
} else {
    echo "<h1>This is a scalene triangle!</h1>";
}
?>
    </div>
</body>
</html>
Example #2
0
    function setSide1($length1)
    {
        $this->side1 = $length;
    }
    function setSide2($length2)
    {
        $this->side2 = $length;
    }
    function setSide3($length3)
    {
        $this->side3 = $length;
    }
}
?>

<html>
    <head>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
        <title>Triangle Results</title>
    </head>
    <body>
        <div class="container">
            <?php 
echo "<p>Side 1 length: " . $user_triangle->getSide1() . "</p>\n                      <p>Side 2 length: " . $user_triangle->getSide2() . "</p>\n                      <p>Side 3 length: " . $user_triangle->getSide3() . "</p>\n                      <p>Your Result: " . $user_triangle->determineTriangle() . "</p>\n\n                        ";
?>

        </div>

    </body>
</html>