forked from ringmaster/dicecalc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
57 lines (42 loc) · 1.02 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
error_reporting(E_ALL | E_STRICT);
require 'src/DiceCalc/Calc.php';
require 'src/DiceCalc/CalcSet.php';
require 'src/DiceCalc/CalcDice.php';
require 'src/DiceCalc/CalcOperation.php';
require 'src/DiceCalc/Random.php';
use DiceCalc\Calc as Calc;
$expression = isset($_GET['expression']) ? $_GET['expression'] : '';
$calc = new Calc( $expression );
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Calc Test</title>
</head>
<body>
<form>
<input type="text" name="expression" value="<?php echo htmlspecialchars( $expression ); ?>">
<input type="submit" value="Calc">
</form>
<style type="text/css">
s {
color: #999;
}
.true {
color: green;
font-weight: bold;
}
.false {
color: #999;
}
</style>
<pre>
<?php
echo "Input: " . htmlspecialchars( $expression ) . "\n";
echo "Infix: " . $calc->infix() . "\n";
echo "Detailed: " . $calc->detailed() . "\n";
echo "Result: " . $calc() . "\n";
?>
</pre>
</body>
</html>