-
Notifications
You must be signed in to change notification settings - Fork 11
/
demo.php
55 lines (41 loc) · 936 Bytes
/
demo.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
<?php
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 htmlspecialchars( $expression ) . "\n";
echo $calc->infix();
echo " => ";
echo $calc() . "\n";
?>
</pre>
</body>
</html>