예제 #1
0
<?php

require_once './calculator.php';
$obj = new calculator();
echo '<pre>';
print_r($_POST);
$first = $_POST['first-number'];
$second = $_POST['second-number'];
$button = $_POST['btn'];
if ($button == 'add') {
    $add = $obj->add($first, $second);
}
if ($button == 'sub') {
    $add = $obj->sub($first, $second);
}
if ($button == 'mul') {
    $add = $obj->mul($first, $second);
}
if ($button == 'div') {
    $add = $obj->div($first, $second);
}
if ($button == 'mod') {
    $add = $obj->mod($first, $second);
}
?>


<html>
    <head>
        <title>Calculator</title>
    </head>