Esempio n. 1
0
<?php

require 'calculator.php';
$obj = new Calculator();
if (isset($_POST['btn'])) {
    $first_number = $_POST['first_number'];
    $last_number = $_POST['last_number'];
    $btn = $_POST['btn'];
    if ($btn == '+') {
        $result = $obj->addition($first_number, $last_number);
    } else {
        if ($btn == '-') {
            $result = $obj->subtraction($first_number, $last_number);
        } else {
            if ($btn == '*') {
                $result = $obj->multiplication($first_number, $last_number);
            } else {
                if ($btn == '/') {
                    $result = $obj->division($first_number, $last_number);
                } else {
                    if ($btn == '%') {
                        $result = $obj->reminder($first_number, $last_number);
                    }
                }
            }
        }
    }
}
?>
<html>
    <head>