示例#1
0
 function _calc($params)
 {
     $user = $params['user'];
     $channel = $params['channel'];
     $query = $params['query'];
     $query = html_entity_decode($query);
     $calc = new Calc($query);
     echo htmlspecialchars($expression) . "\n";
     echo $calc->infix() . " = " . $calc->calc() . "\n";
     $output = Utils::cmdout($params);
     $output .= $calc->infix() . " = " . $calc->calc();
     Status::create()->data($output)->user_id($user->id)->channel($channel)->insert();
     return true;
 }
示例#2
0
?>
">
<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 
include 'calc.php';
$expression = $_GET['expression'];
$calc = new Calc($expression);
echo htmlspecialchars($expression) . "\n";
echo $calc->infix();
echo " => ";
echo $calc->calc() . "\n";
?>
</pre>

  </body>
</html>